- Notifications
You must be signed in to change notification settings - Fork5
Commit3694b4d
committed
Fix incorrect search for "x?" style matches in creviterdissect().
When the number of allowed iterations is limited (either a "?" quantifieror a bound expression), the last sub-match has to reach to the end of thetarget string. The previous coding here first tried the shortest possiblematch (one character, usually) and then gave up and back-tracked if thatdidn't work, typically leading to failure to match overall, as shown inbug #11478 from Christoph Berg. The minimum change to fix that would be tonot decrement k before "goto backtrack"; but that would be a pretty stupidsolution, because we'd laboriously try each possible sub-match lengthbefore finally discovering that only ending at the end can work. Instead,force the sub-match endpoint limit up to the end for even the firstshortest() call if we cannot have any more sub-matches after this one.Bug introduced in my rewrite that added the iterdissect logic, commit173e29a. The shortest-first search codewas too closely modeled on the longest-first code, which hasn't got thisissue since it tries a match reaching to the end to start with anyway.Back-patch to all affected branches.1 parenta564307 commit3694b4d
3 files changed
+16
-0
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1190 | 1190 |
| |
1191 | 1191 |
| |
1192 | 1192 |
| |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1193 | 1197 |
| |
1194 | 1198 |
| |
1195 | 1199 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
188 | 188 |
| |
189 | 189 |
| |
190 | 190 |
| |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + |
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + |
0 commit comments
Comments
(0)