]> granicus.if.org Git - postgresql/commit
Avoid failure when selecting a namespace node in XMLTABLE. REL_11_STABLE github/REL_11_STABLE
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Oct 2019 19:22:40 +0000 (15:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Oct 2019 19:22:40 +0000 (15:22 -0400)
commit9f7a664fe35c40cc9b1a4ebec4fc990dc45370f3
tree3979207f08105069f450e709d35dfb49defe4dd6
parent2930f163f6a5a8b6be62a02f6e88a404ab7fb9e2
Avoid failure when selecting a namespace node in XMLTABLE.

It appears that libxml2 doesn't bother to set the "children" field of
an XML_NAMESPACE_DECL node to null; that field just contains garbage.
In v10 and v11, this can result in a crash in XMLTABLE().  The rewrite
done in commit 251cf2e27 fixed this, somewhat accidentally, in v12.
We're not going to back-patch 251cf2e27, however.  The case apparently
doesn't have wide use, so rather than risk introducing other problems,
just add a safety check to throw an error.

Even though no bug manifests in v12/HEAD, add the relevant test case
there too, to prevent future regressions.

Chapman Flack (per private report)
src/backend/utils/adt/xml.c
src/test/regress/expected/xml.out
src/test/regress/expected/xml_1.out
src/test/regress/expected/xml_2.out
src/test/regress/sql/xml.sql