pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18981: Fault tolerance and improvement for xmltotext_with_options (xml.c)
2+ messages / 2 participants
[nested] [flat]
* BUG #18981: Fault tolerance and improvement for xmltotext_with_options (xml.c)
@ 2025-07-08 09:26 PG Bug reporting form <noreply@postgresql.org>
2025-07-08 16:51 ` Re: BUG #18981: Fault tolerance and improvement for xmltotext_with_options (xml.c) Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2025-07-08 09:26 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: d.kovalenko@postgrespro.ru
The following bug has been logged on the website:
Bug reference: 18981
Logged by: Dmitry Kovalenko
Email address: d.kovalenko@postgrespro.ru
PostgreSQL version: 18beta1
Operating system: any
Description:
Hello,
Please look at this code:
https://github.com/postgres/postgres/blob/a27893df45ec5d8c657899202e9cf0b9a816fe2f/src/backend/utils...
xmlerrcxt = pg_xml_init(PG_XML_STRICTNESS_ALL);
pg_xml_init uses palloc and may "raise an exception".
1)
https://github.com/postgres/postgres/blob/a27893df45ec5d8c657899202e9cf0b9a816fe2f/src/backend/utils...
2)
https://github.com/postgres/postgres/blob/a27893df45ec5d8c657899202e9cf0b9a816fe2f/src/backend/utils...
t it occurres we do not release 'doc' pointer and get memory leaks.
I offer to move a call of pg_xml_init in try{...}catch section
See this commit:
https://github.com/dmitry-lipetsk/postgres/commit/c66d2b05077a8d1f3057560303f3a82f7d717569
Also
Within PG_CATCH 'doc' is not NULL.
https://github.com/postgres/postgres/blob/a27893df45ec5d8c657899202e9cf0b9a816fe2f/src/backend/utils...
It allocates before PG_TRY statement.
https://github.com/postgres/postgres/blob/a27893df45ec5d8c657899202e9cf0b9a816fe2f/src/backend/utils...
So, we can call xmlFreeDoc(doc) without a verification.
Thanks&Regards,
Dmitry Kovalenko
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #18981: Fault tolerance and improvement for xmltotext_with_options (xml.c)
2025-07-08 09:26 BUG #18981: Fault tolerance and improvement for xmltotext_with_options (xml.c) PG Bug reporting form <noreply@postgresql.org>
@ 2025-07-08 16:51 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2025-07-08 16:51 UTC (permalink / raw)
To: d.kovalenko@postgrespro.ru; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> Please look at this code:
> https://github.com/postgres/postgres/blob/a27893df45ec5d8c657899202e9cf0b9a816fe2f/src/backend/utils...
> xmlerrcxt = pg_xml_init(PG_XML_STRICTNESS_ALL);
> pg_xml_init uses palloc and may "raise an exception".
Yup, we should cover that case.
> Also
> Within PG_CATCH 'doc' is not NULL.
Agreed. Pushed your fix with small editorialization.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-07-08 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-08 09:26 BUG #18981: Fault tolerance and improvement for xmltotext_with_options (xml.c) PG Bug reporting form <noreply@postgresql.org>
2025-07-08 16:51 ` Tom Lane <tgl@sss.pgh.pa.us>
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