From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Convert xml_in to report errors softly.
Date: Fri, 16 Dec 2022 16:10:54 +0000
Message-ID: <E1p6DIT-003uc8-6g@gemulon.postgresql.org> (raw)
Convert xml_in to report errors softly.
The key idea here is that xml_parse must distinguish hard errors
from soft errors. We want to throw a hard error for libxml
initialization failures: those might be out-of-memory, or something
else, but in any case they are not the fault of the input string.
If we get to the point of parsing the input, and something goes
wrong, we can fairly consider that to mean bad input.
One thing that arguably does mean bad input, but I didn't trouble
to handle softly, is encoding conversion failure while converting
the server encoding to UTF8. This might be something to improve
later, but it seems like a pretty low-probability scenario.
Discussion: https://postgr.es/m/3564577.1671142683@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/37bef842f5530fc9f4a48daba9f4709ee5e36c9b
Modified Files
--------------
src/backend/utils/adt/xml.c | 155 ++++++++++++++++++++++++++++--------
src/test/regress/expected/xml.out | 31 ++++++++
src/test/regress/expected/xml_1.out | 16 ++++
src/test/regress/expected/xml_2.out | 31 ++++++++
src/test/regress/sql/xml.sql | 7 ++
5 files changed, 205 insertions(+), 35 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Convert xml_in to report errors softly.
In-Reply-To: <E1p6DIT-003uc8-6g@gemulon.postgresql.org>
References: <E1p6DIT-003uc8-6g@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox