pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix crasher bug in array_position(s) 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix crasher bug in array_position(s) @ 2016-12-09 15:44 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 3+ messages in thread From: Alvaro Herrera @ 2016-12-09 15:44 UTC (permalink / raw) To: pgsql-committers Fix crasher bug in array_position(s) array_position and its cousin array_positions were caching the element type equality function's FmgrInfo without being careful enough to put it in a long-lived context. This is obviously broken but it didn't matter in most cases; only when using arrays of records (involving record_eq) it becomes a problem. The fix is to ensure that the type's equality function's FmgrInfo is cached in the array_position's flinfo->fn_mcxt rather than the current memory context. Apart from record types, the only other case that seems complex enough to possibly cause the same problem are range types. I didn't find a way to reproduce the problem with those, so I only include the test case submitted with the bug report as regression test. Bug report and patch: Junseok Yang Discussion: https://postgr.es/m/CAE+byMupUURYiZ6bKYgMZb9pgV1CYAijJGqWj-90W=nS7uEOeA@mail.gmail.com Backpatch to 9.5, where array_position appeared. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/a73491e5fee88f5db70d69e81fa45060b6ed3682 Modified Files -------------- src/backend/utils/adt/array_userfuncs.c | 6 ++++-- src/test/regress/expected/arrays.out | 14 ++++++++++++++ src/test/regress/sql/arrays.sql | 9 +++++++++ 3 files changed, 27 insertions(+), 2 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] 3+ messages in thread
* pgsql: Fix crasher bug in array_position(s) @ 2016-12-09 15:44 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 3+ messages in thread From: Alvaro Herrera @ 2016-12-09 15:44 UTC (permalink / raw) To: pgsql-committers Fix crasher bug in array_position(s) array_position and its cousin array_positions were caching the element type equality function's FmgrInfo without being careful enough to put it in a long-lived context. This is obviously broken but it didn't matter in most cases; only when using arrays of records (involving record_eq) it becomes a problem. The fix is to ensure that the type's equality function's FmgrInfo is cached in the array_position's flinfo->fn_mcxt rather than the current memory context. Apart from record types, the only other case that seems complex enough to possibly cause the same problem are range types. I didn't find a way to reproduce the problem with those, so I only include the test case submitted with the bug report as regression test. Bug report and patch: Junseok Yang Discussion: https://postgr.es/m/CAE+byMupUURYiZ6bKYgMZb9pgV1CYAijJGqWj-90W=nS7uEOeA@mail.gmail.com Backpatch to 9.5, where array_position appeared. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/581b09c72524db9a141a1b9217f01cf2b24ae512 Modified Files -------------- src/backend/utils/adt/array_userfuncs.c | 6 ++++-- src/test/regress/expected/arrays.out | 14 ++++++++++++++ src/test/regress/sql/arrays.sql | 9 +++++++++ 3 files changed, 27 insertions(+), 2 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] 3+ messages in thread
* pgsql: Fix crasher bug in array_position(s) @ 2016-12-09 15:44 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 3+ messages in thread From: Alvaro Herrera @ 2016-12-09 15:44 UTC (permalink / raw) To: pgsql-committers Fix crasher bug in array_position(s) array_position and its cousin array_positions were caching the element type equality function's FmgrInfo without being careful enough to put it in a long-lived context. This is obviously broken but it didn't matter in most cases; only when using arrays of records (involving record_eq) it becomes a problem. The fix is to ensure that the type's equality function's FmgrInfo is cached in the array_position's flinfo->fn_mcxt rather than the current memory context. Apart from record types, the only other case that seems complex enough to possibly cause the same problem are range types. I didn't find a way to reproduce the problem with those, so I only include the test case submitted with the bug report as regression test. Bug report and patch: Junseok Yang Discussion: https://postgr.es/m/CAE+byMupUURYiZ6bKYgMZb9pgV1CYAijJGqWj-90W=nS7uEOeA@mail.gmail.com Backpatch to 9.5, where array_position appeared. Branch ------ REL9_6_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/79c89f1f4e939b7a3f3bb4a76476dcda651cd58b Modified Files -------------- src/backend/utils/adt/array_userfuncs.c | 6 ++++-- src/test/regress/expected/arrays.out | 14 ++++++++++++++ src/test/regress/sql/arrays.sql | 9 +++++++++ 3 files changed, 27 insertions(+), 2 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] 3+ messages in thread
end of thread, other threads:[~2016-12-09 15:44 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-12-09 15:44 pgsql: Fix crasher bug in array_position(s) Alvaro Herrera <alvherre@alvh.no-ip.org> 2016-12-09 15:44 pgsql: Fix crasher bug in array_position(s) Alvaro Herrera <alvherre@alvh.no-ip.org> 2016-12-09 15:44 pgsql: Fix crasher bug in array_position(s) Alvaro Herrera <alvherre@alvh.no-ip.org>
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