pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix low-probability memory leak in regex execution. 11+ messages / 1 participants [nested] [flat]
* pgsql: Fix low-probability memory leak in regex execution. @ 2015-09-18 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2015-09-18 17:55 UTC (permalink / raw) To: pgsql-committers Fix low-probability memory leak in regex execution. After an internal failure in shortest() or longest() while pinning down the exact location of a match, find() forgot to free the DFA structure before returning. This is pretty unlikely to occur, since we just successfully ran the "search" variant of the DFA; but it could happen, and it would result in a session-lifespan memory leak since this code uses malloc() directly. Problem seems to have been aboriginal in Spencer's library, so back-patch all the way. In passing, correct a thinko in a comment I added awhile back about the meaning of the "ntree" field. I happened across these issues while comparing our code to Tcl's version of the library. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/d9c0c728afe734b7087dbb9a4bc16d5b682d139d Modified Files -------------- src/backend/regex/regcomp.c | 2 +- src/backend/regex/regexec.c | 6 +++++- src/include/regex/regguts.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in regex execution. @ 2015-09-18 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2015-09-18 17:55 UTC (permalink / raw) To: pgsql-committers Fix low-probability memory leak in regex execution. After an internal failure in shortest() or longest() while pinning down the exact location of a match, find() forgot to free the DFA structure before returning. This is pretty unlikely to occur, since we just successfully ran the "search" variant of the DFA; but it could happen, and it would result in a session-lifespan memory leak since this code uses malloc() directly. Problem seems to have been aboriginal in Spencer's library, so back-patch all the way. In passing, correct a thinko in a comment I added awhile back about the meaning of the "ntree" field. I happened across these issues while comparing our code to Tcl's version of the library. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/b8431080851e64f5bf9efebc866fc02f0d57f56f Modified Files -------------- src/backend/regex/regcomp.c | 2 +- src/backend/regex/regexec.c | 6 +++++- src/include/regex/regguts.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in regex execution. @ 2015-09-18 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2015-09-18 17:55 UTC (permalink / raw) To: pgsql-committers Fix low-probability memory leak in regex execution. After an internal failure in shortest() or longest() while pinning down the exact location of a match, find() forgot to free the DFA structure before returning. This is pretty unlikely to occur, since we just successfully ran the "search" variant of the DFA; but it could happen, and it would result in a session-lifespan memory leak since this code uses malloc() directly. Problem seems to have been aboriginal in Spencer's library, so back-patch all the way. In passing, correct a thinko in a comment I added awhile back about the meaning of the "ntree" field. I happened across these issues while comparing our code to Tcl's version of the library. Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/28c396134e0640e21610a984b89393825753b30d Modified Files -------------- src/backend/regex/regexec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in regex execution. @ 2015-09-18 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2015-09-18 17:55 UTC (permalink / raw) To: pgsql-committers Fix low-probability memory leak in regex execution. After an internal failure in shortest() or longest() while pinning down the exact location of a match, find() forgot to free the DFA structure before returning. This is pretty unlikely to occur, since we just successfully ran the "search" variant of the DFA; but it could happen, and it would result in a session-lifespan memory leak since this code uses malloc() directly. Problem seems to have been aboriginal in Spencer's library, so back-patch all the way. In passing, correct a thinko in a comment I added awhile back about the meaning of the "ntree" field. I happened across these issues while comparing our code to Tcl's version of the library. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a39331fa573fc2bd6f93322ff190da26ddc477b5 Modified Files -------------- src/backend/regex/regcomp.c | 2 +- src/backend/regex/regexec.c | 6 +++++- src/include/regex/regguts.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in regex execution. @ 2015-09-18 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2015-09-18 17:55 UTC (permalink / raw) To: pgsql-committers Fix low-probability memory leak in regex execution. After an internal failure in shortest() or longest() while pinning down the exact location of a match, find() forgot to free the DFA structure before returning. This is pretty unlikely to occur, since we just successfully ran the "search" variant of the DFA; but it could happen, and it would result in a session-lifespan memory leak since this code uses malloc() directly. Problem seems to have been aboriginal in Spencer's library, so back-patch all the way. In passing, correct a thinko in a comment I added awhile back about the meaning of the "ntree" field. I happened across these issues while comparing our code to Tcl's version of the library. Branch ------ REL9_0_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/ba9eb293fa6466e5dd8dbcf1e51f8126d9d02bb0 Modified Files -------------- src/backend/regex/regexec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in regex execution. @ 2015-09-18 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2015-09-18 17:55 UTC (permalink / raw) To: pgsql-committers Fix low-probability memory leak in regex execution. After an internal failure in shortest() or longest() while pinning down the exact location of a match, find() forgot to free the DFA structure before returning. This is pretty unlikely to occur, since we just successfully ran the "search" variant of the DFA; but it could happen, and it would result in a session-lifespan memory leak since this code uses malloc() directly. Problem seems to have been aboriginal in Spencer's library, so back-patch all the way. In passing, correct a thinko in a comment I added awhile back about the meaning of the "ntree" field. I happened across these issues while comparing our code to Tcl's version of the library. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/f7d896ab919af6ef74117c6121443721902beba3 Modified Files -------------- src/backend/regex/regcomp.c | 2 +- src/backend/regex/regexec.c | 6 +++++- src/include/regex/regguts.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in regex execution. @ 2015-09-18 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2015-09-18 17:55 UTC (permalink / raw) To: pgsql-committers Fix low-probability memory leak in regex execution. After an internal failure in shortest() or longest() while pinning down the exact location of a match, find() forgot to free the DFA structure before returning. This is pretty unlikely to occur, since we just successfully ran the "search" variant of the DFA; but it could happen, and it would result in a session-lifespan memory leak since this code uses malloc() directly. Problem seems to have been aboriginal in Spencer's library, so back-patch all the way. In passing, correct a thinko in a comment I added awhile back about the meaning of the "ntree" field. I happened across these issues while comparing our code to Tcl's version of the library. Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/dc4e8c10169e094f4241efa586459a812bdfd393 Modified Files -------------- src/backend/regex/regcomp.c | 2 +- src/backend/regex/regexec.c | 6 +++++- src/include/regex/regguts.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). @ 2025-07-08 16:50 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2025-07-08 16:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix low-probability memory leak in XMLSERIALIZE(... INDENT). xmltotext_with_options() did not consider the possibility that pg_xml_init() could fail --- most likely due to OOM. If that happened, the already-parsed xmlDoc structure would be leaked. Oversight in commit 483bdb2af. Bug: #18981 Author: Dmitry Kovalenko <d.kovalenko@postgrespro.ru> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/18981-9bc3c80f107ae925@postgresql.org Backpatch-through: 16 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/075554ec6c0c8ef9fca38086624d27d8df2a27d7 Modified Files -------------- src/backend/utils/adt/xml.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). @ 2025-07-08 16:50 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2025-07-08 16:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix low-probability memory leak in XMLSERIALIZE(... INDENT). xmltotext_with_options() did not consider the possibility that pg_xml_init() could fail --- most likely due to OOM. If that happened, the already-parsed xmlDoc structure would be leaked. Oversight in commit 483bdb2af. Bug: #18981 Author: Dmitry Kovalenko <d.kovalenko@postgrespro.ru> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/18981-9bc3c80f107ae925@postgresql.org Backpatch-through: 16 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/95cf1a1817c992769e38cda7437751af54642ef8 Modified Files -------------- src/backend/utils/adt/xml.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). @ 2025-07-08 16:50 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2025-07-08 16:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix low-probability memory leak in XMLSERIALIZE(... INDENT). xmltotext_with_options() did not consider the possibility that pg_xml_init() could fail --- most likely due to OOM. If that happened, the already-parsed xmlDoc structure would be leaked. Oversight in commit 483bdb2af. Bug: #18981 Author: Dmitry Kovalenko <d.kovalenko@postgrespro.ru> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/18981-9bc3c80f107ae925@postgresql.org Backpatch-through: 16 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/abb517d619c35cedb13e0c593dcd4cc4219f3aff Modified Files -------------- src/backend/utils/adt/xml.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 11+ messages in thread
* pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). @ 2025-07-08 16:50 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 11+ messages in thread From: Tom Lane @ 2025-07-08 16:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix low-probability memory leak in XMLSERIALIZE(... INDENT). xmltotext_with_options() did not consider the possibility that pg_xml_init() could fail --- most likely due to OOM. If that happened, the already-parsed xmlDoc structure would be leaked. Oversight in commit 483bdb2af. Bug: #18981 Author: Dmitry Kovalenko <d.kovalenko@postgrespro.ru> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/18981-9bc3c80f107ae925@postgresql.org Backpatch-through: 16 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/e03c95287764158941d317972a332565729b6af2 Modified Files -------------- src/backend/utils/adt/xml.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2025-07-08 16:50 UTC | newest] Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-09-18 17:55 pgsql: Fix low-probability memory leak in regex execution. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-18 17:55 pgsql: Fix low-probability memory leak in regex execution. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-18 17:55 pgsql: Fix low-probability memory leak in regex execution. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-18 17:55 pgsql: Fix low-probability memory leak in regex execution. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-18 17:55 pgsql: Fix low-probability memory leak in regex execution. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-18 17:55 pgsql: Fix low-probability memory leak in regex execution. Tom Lane <tgl@sss.pgh.pa.us> 2015-09-18 17:55 pgsql: Fix low-probability memory leak in regex execution. Tom Lane <tgl@sss.pgh.pa.us> 2025-07-08 16:50 pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). Tom Lane <tgl@sss.pgh.pa.us> 2025-07-08 16:50 pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). Tom Lane <tgl@sss.pgh.pa.us> 2025-07-08 16:50 pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). Tom Lane <tgl@sss.pgh.pa.us> 2025-07-08 16:50 pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT). 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