| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Andrey Chernyy <andrey(dot)cherny(at)tantorlabs(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [PATCH] xml2: Fix stylesheet document leak in xslt_process() |
| Date: | 2026-06-05 04:53:36 |
| Message-ID: | aiJWUH85UH4nVex_@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Jun 05, 2026 at 02:46:42AM +0300, Andrey Chernyy wrote:
> xslt_process() parses the stylesheet argument with xmlReadMemory(), then
> passes the resulting xmlDoc to xsltParseStylesheetDoc(). On failure,
> libxslt leaves that document owned by the caller, as can be seen from
> its own xsltParseStylesheetFile() wrapper. Postgres currently cannot
> release it in the error cleanup path because ssdoc is scoped inside the
> PG_TRY block.
In libxslt/xslt.c, the top comment of xsltParseStylesheetDoc() says:
"the doc is automatically freed when the stylesheet is closed."
Reading the code, I can confirm that xsltFreeStylesheet() does a bunch
of stuff, and that it has the idea to call xmlFreeDoc() once at the
end.
Will address this one as well. Thanks.
--
Michael
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-06-05 05:12:31 | Re: Heads Up: cirrus-ci is shutting down June 1st |
| Previous Message | Michael Paquier | 2026-06-05 03:45:32 | Re: [PATCH] Use ssup_datum_*_cmp for int2, oid, and oid8 sort support |