forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7865280
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 parent53a53ea commit7865280
File tree
3 files changed
+25
-10
lines changed- contrib/pg_trgm
- expected
- sql
3 files changed
+25
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1044 | 1044 | | |
1045 | 1045 | | |
1046 | 1046 | | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1944 | 1944 | | |
1945 | 1945 | | |
1946 | 1946 | | |
1947 | | - | |
1948 | | - | |
1949 | | - | |
| 1947 | + | |
1950 | 1948 | | |
1951 | 1949 | | |
1952 | 1950 | | |
| |||
2018 | 2016 | | |
2019 | 2017 | | |
2020 | 2018 | | |
2021 | | - | |
2022 | | - | |
2023 | | - | |
| 2019 | + | |
2024 | 2020 | | |
2025 | | - | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
2026 | 2027 | | |
2027 | | - | |
2028 | | - | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
2029 | 2033 | | |
| 2034 | + | |
2030 | 2035 | | |
2031 | | - | |
| 2036 | + | |
| 2037 | + | |
2032 | 2038 | | |
2033 | 2039 | | |
2034 | 2040 | | |
| |||
0 commit comments
Comments
(0)