Re: [PATCH] contrib/xml2: backend crash in xpath_nodeset() on the namespace axis

Andrey Chernyy <andrey.cherny@tantorlabs.com>

From: Andrey Chernyy <andrey.cherny@tantorlabs.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2026-06-11T22:59:06Z
Lists: pgsql-bugs
On Thu, 11 Jun 2026 10:48:30 +0900
Michael Paquier <michael@paquier.xyz> wrote:

> What do you think?  That also deserves a backpatch to me, even if it
> is less worse than the xml2 crash you have reported.
> 
> I have grouped this fix with your patch in the attached.  Both still
> need some tests.  Each fix deserves its own commit, that's just a
> quick FYI version.

Thanks Michael, and thanks for adding the tests and back-patching! The
grouped patch looks good to me - applying the same XML_NAMESPACE_DECL
fallback to xmlXPathCastNodeToString() in core xml.c makes sense too. I
had a regression test in progress, but glad it's already covered.

--
Andrey Chernyy



Commits

  1. Fix handling of namespace nodes in xpath() (xml)

  2. xml2: Fix crash with namespace nodes in xpath_nodeset()