pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB
5+ messages / 1 participants
[nested] [flat]

* pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB
@ 2026-11-02 01:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2026-11-02 01:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB.

In xmltotext_with_options(), xmlSaveClose() frees the save context
unconditionally, but ctxt was only reset to NULL on the error branch.
When the close succeeded and a later step threw an error -- typically,
cstring_to_text_with_len() rejecting a result larger than MaxAllocSize
-- control reached the PG_CATCH block with ctxt still pointing at the
freed context, so xmlSaveClose() was called a second time on freed
memory and crashed the backend.

Author: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/bbadb6b2-d226-41a1-ace3-e0eb20648f58@uni-muenster.de
Backpatch-through: 16

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/01131ca43bbf798be6ec237a33f6bef67bede888

Modified Files
--------------
src/backend/utils/adt/xml.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB
@ 2026-11-02 01:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2026-11-02 01:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB.

In xmltotext_with_options(), xmlSaveClose() frees the save context
unconditionally, but ctxt was only reset to NULL on the error branch.
When the close succeeded and a later step threw an error -- typically,
cstring_to_text_with_len() rejecting a result larger than MaxAllocSize
-- control reached the PG_CATCH block with ctxt still pointing at the
freed context, so xmlSaveClose() was called a second time on freed
memory and crashed the backend.

Author: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/bbadb6b2-d226-41a1-ace3-e0eb20648f58@uni-muenster.de
Backpatch-through: 16

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bfe9c23ee584996bcc88a5a478399f19c3102d1f

Modified Files
--------------
src/backend/utils/adt/xml.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB
@ 2026-11-02 01:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2026-11-02 01:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB.

In xmltotext_with_options(), xmlSaveClose() frees the save context
unconditionally, but ctxt was only reset to NULL on the error branch.
When the close succeeded and a later step threw an error -- typically,
cstring_to_text_with_len() rejecting a result larger than MaxAllocSize
-- control reached the PG_CATCH block with ctxt still pointing at the
freed context, so xmlSaveClose() was called a second time on freed
memory and crashed the backend.

Author: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/bbadb6b2-d226-41a1-ace3-e0eb20648f58@uni-muenster.de
Backpatch-through: 16

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f10500777b2a4d3da6d8d1dd0602e542a4300410

Modified Files
--------------
src/backend/utils/adt/xml.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB
@ 2026-11-02 01:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2026-11-02 01:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB.

In xmltotext_with_options(), xmlSaveClose() frees the save context
unconditionally, but ctxt was only reset to NULL on the error branch.
When the close succeeded and a later step threw an error -- typically,
cstring_to_text_with_len() rejecting a result larger than MaxAllocSize
-- control reached the PG_CATCH block with ctxt still pointing at the
freed context, so xmlSaveClose() was called a second time on freed
memory and crashed the backend.

Author: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/bbadb6b2-d226-41a1-ace3-e0eb20648f58@uni-muenster.de
Backpatch-through: 16

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7fa0a5f21cdf241a3f19641a6846eabbd2fbcce5

Modified Files
--------------
src/backend/utils/adt/xml.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB
@ 2026-11-02 01:46 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2026-11-02 01:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB.

In xmltotext_with_options(), xmlSaveClose() frees the save context
unconditionally, but ctxt was only reset to NULL on the error branch.
When the close succeeded and a later step threw an error -- typically,
cstring_to_text_with_len() rejecting a result larger than MaxAllocSize
-- control reached the PG_CATCH block with ctxt still pointing at the
freed context, so xmlSaveClose() was called a second time on freed
memory and crashed the backend.

Author: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/bbadb6b2-d226-41a1-ace3-e0eb20648f58@uni-muenster.de
Backpatch-through: 16

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/582db3ee09e9d2128c2510937bbc3c9f763d97bf

Modified Files
--------------
src/backend/utils/adt/xml.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2026-11-02 01:46 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 01:46 pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB Tom Lane <tgl@sss.pgh.pa.us>
2026-11-02 01:46 pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB Tom Lane <tgl@sss.pgh.pa.us>
2026-11-02 01:46 pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB Tom Lane <tgl@sss.pgh.pa.us>
2026-11-02 01:46 pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB Tom Lane <tgl@sss.pgh.pa.us>
2026-11-02 01:46 pgsql: Fix double-free when XMLSERIALIZE(... INDENT) output exceeds 1GB 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