postgresql/contrib/pg_trgm
Tom Lane 1925ac281a 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
2023-03-11 12:15:41 -05:00
..
data Add files forgotten in f576b17cd6 2016-03-16 19:23:41 +03:00
expected Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. 2023-03-11 12:15:41 -05:00
sql Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. 2023-03-11 12:15:41 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_trgm--1.0--1.1.sql Fix typo in update scripts for some contrib modules. 2013-07-19 04:13:01 +09:00
pg_trgm--1.1--1.2.sql Add word_similarity to pg_trgm contrib module. 2016-03-16 18:59:21 +03:00
pg_trgm--1.2--1.3.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
pg_trgm--1.3--1.4.sql Add strict_word_similarity to pg_trgm module 2018-03-21 14:57:42 +03:00
pg_trgm--1.3.sql Remove support for upgrading extensions from "unpackaged" state. 2020-02-19 16:59:14 -05:00
pg_trgm--1.4--1.5.sql Fix typo in contrib/pg_trgm/pg_trgm--1.4--1.5.sql 2020-11-12 08:55:09 +03:00
pg_trgm--1.5--1.6.sql Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
pg_trgm.control Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
trgm.h Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests. 2022-10-06 11:08:56 -04:00
trgm_gin.c New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
trgm_gist.c Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
trgm_op.c Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
trgm_regexp.c Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. 2023-03-11 12:15:41 -05:00