Re: BUG #18943: Return value of a function 'xmlBufferCreate' isdereferenced at xpath.c:177 without checking for NUL

cca5507 <cca5507@qq.com>

From: cca5507 <cca5507@qq.com>
To: Michael Paquier <michael@paquier.xyz>, Jim Jones <jim.jones@uni-muenster.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-bugs <pgsql-bugs@lists.postgresql.org>, maralist86 <maralist86@mail.ru>
Date: 2026-03-08T15:05:32Z
Lists: pgsql-bugs

Attachments

> It seems that there are 2 misuse of "volatile" in xml.c:
> 
> 1) xmltext()
> 
> volatile xmlChar *xmlbuf = NULL; // -> xmlChar *volatile xmlbuf = NULL;
> 
> 2) xml_xmlnodetoxmltype()
> 
> volatile xmlChar *str = NULL; // -> xmlChar *volatile str = NULL;
> 
> We want the pointer itself be volatile rather than what it points to.

Attach a small patch.

--
Regards,
ChangAo Chen

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. xml2: Fix failure with xslt_process() under -fsanitize=undefined

  2. Fix misuse of "volatile" in xml.c

  3. xml2: Improve error handling of libxml2 calls

  4. Improve error handling of libxml2 calls in xml.c