agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset()
6+ messages / 1 participants
[nested] [flat]

* pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset()
@ 2026-06-11 05:29 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-06-11 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xml2: Fix crash with namespace nodes in xpath_nodeset()

pgxmlNodeSetToText() passed nodeTab[i]->doc to xmlNodeDump() without
checking the node type, which could cause a crash as a
XML_NAMESPACE_DECL maps to a xmlNs struct.  The passed-in code would
then be dereferenced in xmlNodeDump().

This commit switches the code to render XML_NAMESPACE_DECL nodes with
xmlXPathCastNodeToString(), like xpath_table().  Some tests are added,
written by me.

Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20260611031436.5afde3cb@andrnote
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9d33a5a804db48b254de7a0ad2fde03152f378e3

Modified Files
--------------
contrib/xml2/expected/xml2.out   |  8 ++++++++
contrib/xml2/expected/xml2_1.out |  8 ++++++++
contrib/xml2/sql/xml2.sql        |  3 +++
contrib/xml2/xpath.c             | 23 +++++++++++++++++++----
4 files changed, 38 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset()
@ 2026-06-11 05:29 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-06-11 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xml2: Fix crash with namespace nodes in xpath_nodeset()

pgxmlNodeSetToText() passed nodeTab[i]->doc to xmlNodeDump() without
checking the node type, which could cause a crash as a
XML_NAMESPACE_DECL maps to a xmlNs struct.  The passed-in code would
then be dereferenced in xmlNodeDump().

This commit switches the code to render XML_NAMESPACE_DECL nodes with
xmlXPathCastNodeToString(), like xpath_table().  Some tests are added,
written by me.

Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20260611031436.5afde3cb@andrnote
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/91b57eadeb0f1f971aebfc3f9c9045477b0e0438

Modified Files
--------------
contrib/xml2/expected/xml2.out   |  8 ++++++++
contrib/xml2/expected/xml2_1.out |  8 ++++++++
contrib/xml2/sql/xml2.sql        |  3 +++
contrib/xml2/xpath.c             | 15 +++++++++++----
4 files changed, 30 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset()
@ 2026-06-11 05:29 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-06-11 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xml2: Fix crash with namespace nodes in xpath_nodeset()

pgxmlNodeSetToText() passed nodeTab[i]->doc to xmlNodeDump() without
checking the node type, which could cause a crash as a
XML_NAMESPACE_DECL maps to a xmlNs struct.  The passed-in code would
then be dereferenced in xmlNodeDump().

This commit switches the code to render XML_NAMESPACE_DECL nodes with
xmlXPathCastNodeToString(), like xpath_table().  Some tests are added,
written by me.

Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20260611031436.5afde3cb@andrnote
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4a49ab2890859c62dd49959b0f6cfbbd516b8310

Modified Files
--------------
contrib/xml2/expected/xml2.out   |  8 ++++++++
contrib/xml2/expected/xml2_1.out |  8 ++++++++
contrib/xml2/sql/xml2.sql        |  4 ++++
contrib/xml2/xpath.c             | 15 +++++++++++----
4 files changed, 31 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset()
@ 2026-06-11 05:29 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-06-11 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xml2: Fix crash with namespace nodes in xpath_nodeset()

pgxmlNodeSetToText() passed nodeTab[i]->doc to xmlNodeDump() without
checking the node type, which could cause a crash as a
XML_NAMESPACE_DECL maps to a xmlNs struct.  The passed-in code would
then be dereferenced in xmlNodeDump().

This commit switches the code to render XML_NAMESPACE_DECL nodes with
xmlXPathCastNodeToString(), like xpath_table().  Some tests are added,
written by me.

Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20260611031436.5afde3cb@andrnote
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/18955d412c8228fbb1f1982ea0d6231dae7d9611

Modified Files
--------------
contrib/xml2/expected/xml2.out   |  8 ++++++++
contrib/xml2/expected/xml2_1.out |  8 ++++++++
contrib/xml2/sql/xml2.sql        |  4 ++++
contrib/xml2/xpath.c             | 15 +++++++++++----
4 files changed, 31 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset()
@ 2026-06-11 05:29 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-06-11 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xml2: Fix crash with namespace nodes in xpath_nodeset()

pgxmlNodeSetToText() passed nodeTab[i]->doc to xmlNodeDump() without
checking the node type, which could cause a crash as a
XML_NAMESPACE_DECL maps to a xmlNs struct.  The passed-in code would
then be dereferenced in xmlNodeDump().

This commit switches the code to render XML_NAMESPACE_DECL nodes with
xmlXPathCastNodeToString(), like xpath_table().  Some tests are added,
written by me.

Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20260611031436.5afde3cb@andrnote
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bc5775149f59cc6d80c2a5ceb410bba473a12407

Modified Files
--------------
contrib/xml2/expected/xml2.out   |  8 ++++++++
contrib/xml2/expected/xml2_1.out |  8 ++++++++
contrib/xml2/sql/xml2.sql        |  4 ++++
contrib/xml2/xpath.c             | 15 +++++++++++----
4 files changed, 31 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset()
@ 2026-06-11 05:29 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-06-11 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xml2: Fix crash with namespace nodes in xpath_nodeset()

pgxmlNodeSetToText() passed nodeTab[i]->doc to xmlNodeDump() without
checking the node type, which could cause a crash as a
XML_NAMESPACE_DECL maps to a xmlNs struct.  The passed-in code would
then be dereferenced in xmlNodeDump().

This commit switches the code to render XML_NAMESPACE_DECL nodes with
xmlXPathCastNodeToString(), like xpath_table().  Some tests are added,
written by me.

Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20260611031436.5afde3cb@andrnote
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f3f901a53a17da5c4f21c1df628d187b6aff1889

Modified Files
--------------
contrib/xml2/expected/xml2.out   |  8 ++++++++
contrib/xml2/expected/xml2_1.out |  8 ++++++++
contrib/xml2/sql/xml2.sql        |  4 ++++
contrib/xml2/xpath.c             | 15 +++++++++++----
4 files changed, 31 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-06-11 05:29 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-11 05:29 pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset() Michael Paquier <michael@paquier.xyz>
2026-06-11 05:29 pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset() Michael Paquier <michael@paquier.xyz>
2026-06-11 05:29 pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset() Michael Paquier <michael@paquier.xyz>
2026-06-11 05:29 pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset() Michael Paquier <michael@paquier.xyz>
2026-06-11 05:29 pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset() Michael Paquier <michael@paquier.xyz>
2026-06-11 05:29 pgsql: xml2: Fix crash with namespace nodes in xpath_nodeset() Michael Paquier <michael@paquier.xyz>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox