- Notifications
You must be signed in to change notification settings - Fork28
Commit49c928c
committed
Fix ancient bug in parsing of BRE-mode regular expressions.
brenext(), when parsing a '*' quantifier, forgot to return any "value"for the token; per the equivalent case in next(), it should returnvalue 1 to indicate that greedy rather than non-greedy behavior iswanted. The result is that the compiled regexp could behave like 'x*?'rather than the intended 'x*', if we were unlucky enough to havea zero in v->nextvalue at this point. That seems to happen with somereliability if we have '.*' at the beginning of a BRE-mode regexp,although that depends on the initial contents of a stack-allocatedstruct, so it's not guaranteed to fail.Found by Alexander Lakhin using valgrind testing. This bug seemsto be aboriginal in Spencer's code, so back-patch all the way.Discussion:https://postgr.es/m/16814-6c5e3edd2bdf0d50@postgresql.org1 parent5ba0469 commit49c928c
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
994 | 994 |
| |
995 | 995 |
| |
996 | 996 |
| |
997 |
| - | |
| 997 | + | |
998 | 998 |
| |
999 | 999 |
| |
1000 | 1000 |
| |
|
0 commit comments
Comments
(0)