pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. @ 2023-03-11 17:15 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-03-11 17:15 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. If the regex compiler can see that a regex is unsatisfiable (for example, '$foo') then it may emit an NFA having no arcs. pg_trgm's packGraph function did the wrong thing in this case; it would access off the end of a work array, and with bad luck could produce a corrupted output data structure causing more problems later. This could end with wrong answers or crashes in queries using a pg_trgm GIN or GiST index with such a regex. Fix by not trying to de-duplicate if there aren't at least 2 arcs. Per bug #17830 from Alexander Lakhin. Back-patch to all supported branches. Discussion: https://postgr.es/m/17830-57ff5f89bdb02b09@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1925ac281a238fab50e208548f98daffdaaa0896 Modified Files -------------- contrib/pg_trgm/expected/pg_word_trgm.out | 6 ++++++ contrib/pg_trgm/sql/pg_word_trgm.sql | 3 +++ contrib/pg_trgm/trgm_regexp.c | 26 ++++++++++++++++---------- 3 files changed, 25 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. @ 2023-03-11 17:15 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-03-11 17:15 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. If the regex compiler can see that a regex is unsatisfiable (for example, '$foo') then it may emit an NFA having no arcs. pg_trgm's packGraph function did the wrong thing in this case; it would access off the end of a work array, and with bad luck could produce a corrupted output data structure causing more problems later. This could end with wrong answers or crashes in queries using a pg_trgm GIN or GiST index with such a regex. Fix by not trying to de-duplicate if there aren't at least 2 arcs. Per bug #17830 from Alexander Lakhin. Back-patch to all supported branches. Discussion: https://postgr.es/m/17830-57ff5f89bdb02b09@postgresql.org Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6170386c7fc1c1cfd7c2a655b8107872d18a0193 Modified Files -------------- contrib/pg_trgm/expected/pg_word_trgm.out | 6 ++++++ contrib/pg_trgm/sql/pg_word_trgm.sql | 3 +++ contrib/pg_trgm/trgm_regexp.c | 26 ++++++++++++++++---------- 3 files changed, 25 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. @ 2023-03-11 17:15 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-03-11 17:15 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. If the regex compiler can see that a regex is unsatisfiable (for example, '$foo') then it may emit an NFA having no arcs. pg_trgm's packGraph function did the wrong thing in this case; it would access off the end of a work array, and with bad luck could produce a corrupted output data structure causing more problems later. This could end with wrong answers or crashes in queries using a pg_trgm GIN or GiST index with such a regex. Fix by not trying to de-duplicate if there aren't at least 2 arcs. Per bug #17830 from Alexander Lakhin. Back-patch to all supported branches. Discussion: https://postgr.es/m/17830-57ff5f89bdb02b09@postgresql.org Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/786528039911c2270589bb690afab20116ee88f3 Modified Files -------------- contrib/pg_trgm/expected/pg_word_trgm.out | 6 ++++++ contrib/pg_trgm/sql/pg_word_trgm.sql | 3 +++ contrib/pg_trgm/trgm_regexp.c | 26 ++++++++++++++++---------- 3 files changed, 25 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. @ 2023-03-11 17:15 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-03-11 17:15 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. If the regex compiler can see that a regex is unsatisfiable (for example, '$foo') then it may emit an NFA having no arcs. pg_trgm's packGraph function did the wrong thing in this case; it would access off the end of a work array, and with bad luck could produce a corrupted output data structure causing more problems later. This could end with wrong answers or crashes in queries using a pg_trgm GIN or GiST index with such a regex. Fix by not trying to de-duplicate if there aren't at least 2 arcs. Per bug #17830 from Alexander Lakhin. Back-patch to all supported branches. Discussion: https://postgr.es/m/17830-57ff5f89bdb02b09@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/bc436e4a917a7185847e05797249ea889214bffe Modified Files -------------- contrib/pg_trgm/expected/pg_word_trgm.out | 6 ++++++ contrib/pg_trgm/sql/pg_word_trgm.sql | 3 +++ contrib/pg_trgm/trgm_regexp.c | 26 ++++++++++++++++---------- 3 files changed, 25 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. @ 2023-03-11 17:15 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-03-11 17:15 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. If the regex compiler can see that a regex is unsatisfiable (for example, '$foo') then it may emit an NFA having no arcs. pg_trgm's packGraph function did the wrong thing in this case; it would access off the end of a work array, and with bad luck could produce a corrupted output data structure causing more problems later. This could end with wrong answers or crashes in queries using a pg_trgm GIN or GiST index with such a regex. Fix by not trying to de-duplicate if there aren't at least 2 arcs. Per bug #17830 from Alexander Lakhin. Back-patch to all supported branches. Discussion: https://postgr.es/m/17830-57ff5f89bdb02b09@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1279414bc613316d3cb7216790bc943d5af8be70 Modified Files -------------- contrib/pg_trgm/expected/pg_word_trgm.out | 6 ++++++ contrib/pg_trgm/sql/pg_word_trgm.sql | 3 +++ contrib/pg_trgm/trgm_regexp.c | 26 ++++++++++++++++---------- 3 files changed, 25 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. @ 2023-03-11 17:15 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-03-11 17:15 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. If the regex compiler can see that a regex is unsatisfiable (for example, '$foo') then it may emit an NFA having no arcs. pg_trgm's packGraph function did the wrong thing in this case; it would access off the end of a work array, and with bad luck could produce a corrupted output data structure causing more problems later. This could end with wrong answers or crashes in queries using a pg_trgm GIN or GiST index with such a regex. Fix by not trying to de-duplicate if there aren't at least 2 arcs. Per bug #17830 from Alexander Lakhin. Back-patch to all supported branches. Discussion: https://postgr.es/m/17830-57ff5f89bdb02b09@postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b18327489b3be5c30ae51eaf24479da7c0af1aaa Modified Files -------------- contrib/pg_trgm/expected/pg_word_trgm.out | 6 ++++++ contrib/pg_trgm/sql/pg_word_trgm.sql | 3 +++ contrib/pg_trgm/trgm_regexp.c | 26 ++++++++++++++++---------- 3 files changed, 25 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2023-03-11 17:15 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-03-11 17:15 pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-11 17:15 pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-11 17:15 pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-11 17:15 pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-11 17:15 pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. Tom Lane <tgl@sss.pgh.pa.us> 2023-03-11 17:15 pgsql: Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. 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