postgresql/contrib/xml2
Michael Paquier 7d64419f80 xml2: Fix failure with xslt_process() under -fsanitize=undefined
The logic of xslt_process() has never considered the fact that
xsltSaveResultToString() would return NULL for an empty string (the
upstream code has always done so, with a string length of 0).  This
would cause memcpy() to be called with a NULL pointer, something
forbidden by POSIX.

Like 46ab07ffda and similar fixes, this is backpatched down to all the
supported branches, with a test case to cover this scenario.  An empty
string has been always returned in xml2 in this case, based on the
history of the module, so this is an old issue.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/c516a0d9-4406-47e3-9087-5ca5176ebcf9@gmail.com
Backpatch-through: 14
2026-03-13 16:06:28 +09:00
..
expected xml2: Fix failure with xslt_process() under -fsanitize=undefined 2026-03-13 16:06:28 +09:00
sql xml2: Fix failure with xslt_process() under -fsanitize=undefined 2026-03-13 16:06:28 +09:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile contrib/xml2: Use SQL-standard function bodies. 2024-12-29 13:53:00 -05:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
xml2--1.0--1.1.sql Update xml2 extension for parallel query. 2016-06-14 15:49:32 -04:00
xml2--1.1--1.2.sql contrib/xml2: Use SQL-standard function bodies. 2024-12-29 13:53:00 -05:00
xml2--1.1.sql Update xml2 extension for parallel query. 2016-06-14 15:49:32 -04:00
xml2.control contrib/xml2: Use SQL-standard function bodies. 2024-12-29 13:53:00 -05:00
xpath.c Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
xslt_proc.c xml2: Fix failure with xslt_process() under -fsanitize=undefined 2026-03-13 16:06:28 +09:00