forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbc436e4
committed
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 luckcould produce a corrupted output data structure causing moreproblems later. This could end with wrong answers or crashesin 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 supportedbranches.Discussion:https://postgr.es/m/17830-57ff5f89bdb02b09@postgresql.org1 parent866fd00 commitbc436e4
File tree
3 files changed
+25
-10
lines changed- contrib/pg_trgm
- expected
- sql
3 files changed
+25
-10
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1044 | 1044 |
| |
1045 | 1045 |
| |
1046 | 1046 |
| |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + |
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
| 46 | + | |
| 47 | + | |
| 48 | + |
Lines changed: 16 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1929 | 1929 |
| |
1930 | 1930 |
| |
1931 | 1931 |
| |
1932 |
| - | |
1933 |
| - | |
1934 |
| - | |
| 1932 | + | |
1935 | 1933 |
| |
1936 | 1934 |
| |
1937 | 1935 |
| |
| |||
2003 | 2001 |
| |
2004 | 2002 |
| |
2005 | 2003 |
| |
2006 |
| - | |
2007 |
| - | |
2008 |
| - | |
| 2004 | + | |
2009 | 2005 |
| |
2010 |
| - | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
2011 | 2012 |
| |
2012 |
| - | |
2013 |
| - | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
2014 | 2018 |
| |
| 2019 | + | |
2015 | 2020 |
| |
2016 |
| - | |
| 2021 | + | |
| 2022 | + | |
2017 | 2023 |
| |
2018 | 2024 |
| |
2019 | 2025 |
| |
|
0 commit comments
Comments
(0)