Re: BUG #18274: Error 'invalid XML content' - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #18274: Error 'invalid XML content'
Date
Msg-id ZaZI4WAHZ67ZHq7p@paquier.xyz
Whole thread Raw
In response to Re: BUG #18274: Error 'invalid XML content'  (Dmitry Koval <d.koval@postgrespro.ru>)
Responses Re: BUG #18274: Error 'invalid XML content'
List pgsql-bugs
On Mon, Jan 15, 2024 at 06:47:17PM +0300, Dmitry Koval wrote:
> I think that's right (flag XML_PARSE_HUGE shouldn't cause any problems).
> My main doubts are related to the replacement of the
> xmlParseBalancedChunkMemory() function (that haven't argument for pass
> XML_PARSE_HUGE flag) with xmlNewNode() + xmlParseInNodeContext() functions
> (create a fake node and pass the XML_PARSE_HUGE flag to
> xmlParseInNodeContext function).
>
> I'm not sure if this replacement is 100% equivalent (although simple tests
> work the same).

Hmm, it looks like this is actually equivalent in terms of parsing a
well-balanced chunk.  This was suggested in the upstream ticket you
have opened and I find that pretty cool, reusing the trick of a fake
root node to use the other API.  Now, there are two things that we'd
better do here:
- Document in a comment why a fake root node is necessary (aka the
current routines don't give enough control over the limits you'd like
to enforce).
- The top comment of xml_parse() still mentions
xmlParseBalancedChunkMemory() as an effect of 483bdb2afec9, so this
needs to be updated.

The switch xmlParseMemory() -> xmlReadMemory() is recommended by the
upstream docs and the former is deprecated:
https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlParseMemory

Also, it may be worth double-checking if there are other things marked
as deprecated in the upstream doc, and switch to "newer" things.

It seems like anything discussed here should only be done on HEAD.
I suspect that the buildfarm may get bumpy on that, but let's see.
--
Michael

Attachment

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18297: Error when adding a column to a parent table with complex inheritance
Next
From: PG Bug reporting form
Date:
Subject: BUG #18298: some possible issues in postgres10.23 that caused the crash