- Notifications
You must be signed in to change notification settings - Fork4.9k
Commite2bd904
committed
Fix regex match failures for backrefs combined with non-greedy quantifiers.
An ancient logic error in cfindloop() could cause the regex engine to failto find matches that begin later than the start of the string. Thisfunction is only used when the regex pattern contains a back reference,and so far as we can tell the error is only reachable if the pattern isnon-greedy (i.e. its first quantifier uses the ? modifier). Furthermore,the actual match must begin after some potential match that satisfies theDFA but then fails the back-reference's match test.Reported and fixed by Jeevan Chalke, with cosmetic adjustments by me.1 parent4cbe3ac commite2bd904
3 files changed
+31
-9
lines changedLines changed: 11 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
487 | 487 |
| |
488 | 488 |
| |
489 | 489 |
| |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
| 490 | + | |
497 | 491 |
| |
| 492 | + | |
| 493 | + | |
| 494 | + | |
498 | 495 |
| |
| 496 | + | |
499 | 497 |
| |
| 498 | + | |
| 499 | + | |
| 500 | + | |
500 | 501 |
| |
501 |
| - | |
502 |
| - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
503 | 505 |
| |
504 | 506 |
| |
505 | 507 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
173 | 173 |
| |
174 | 174 |
| |
175 | 175 |
| |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + |
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + |
0 commit comments
Comments
(0)