- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit0c23f30
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 parent155bfbb commit0c23f30
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
968 | 968 |
| |
969 | 969 |
| |
970 | 970 |
| |
971 |
| - | |
| 971 | + | |
972 | 972 |
| |
973 | 973 |
| |
974 | 974 |
| |
|
0 commit comments
Comments
(0)