forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcb76fbd
committed
Make regexp engine's backref-related compilation state more bulletproof.
Up to now, we remembered the definition of a capturing parenthesissubexpression by storing a pointer to the associated subRE node.That was okay before, because that subRE didn't get modified anymorewhile parsing the rest of the regexp. However, in the wake ofcommitea1268f, that's no longer true: the outer invocation ofparseqatom() feels free to scribble on that subRE. This seems towork anyway, because the states we jam into the child atom in the"prepare a general-purpose state skeleton" stanza aren't reallysemantically different from the original endpoints of the child atom.But that would be mighty easy to break, and it's definitely not howthings worked before.Between this and the issue fixed in the prior commit, it seems bestto get rid of this dependence on subRE nodes entirely. We don't needthe whole child subRE for future backrefs, only its starting and endingNFA states; so let's just store pointers to those.Also, in the corner case where we make an extra subRE to handleimmediately-nested capturing parentheses, it seems like it'd be smartto have the extra subRE have the same begin/end states as the originalchild subRE does (s/s2 not lp/rp). I think that linking it from lp torp might actually be semantically wrong, though since Spencer's originalcode did it that way, I'm not totally certain. Using s/s2 is certainlynot wrong, in any case.Per report from Mark Dilger. Back-patch to v14 where the problematicpatches came in.Discussion:https://postgr.es/m/0203588E-E609-43AF-9F4F-902854231EE7@enterprisedb.com1 parentcc18687 commitcb76fbd
1 file changed
+35
-22
lines changedLines changed: 35 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
233 | 233 |
| |
234 | 234 |
| |
235 | 235 |
| |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
236 | 243 |
| |
237 | 244 |
| |
238 | 245 |
| |
| |||
245 | 252 |
| |
246 | 253 |
| |
247 | 254 |
| |
248 |
| - | |
249 |
| - | |
250 |
| - | |
251 |
| - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
252 | 259 |
| |
253 | 260 |
| |
254 | 261 |
| |
| |||
368 | 375 |
| |
369 | 376 |
| |
370 | 377 |
| |
371 |
| - | |
| 378 | + | |
372 | 379 |
| |
373 | 380 |
| |
374 | 381 |
| |
| |||
504 | 511 |
| |
505 | 512 |
| |
506 | 513 |
| |
507 |
| - | |
| 514 | + | |
508 | 515 |
| |
509 | 516 |
| |
510 | 517 |
| |
511 | 518 |
| |
512 | 519 |
| |
513 |
| - | |
| 520 | + | |
514 | 521 |
| |
515 | 522 |
| |
516 | 523 |
| |
517 | 524 |
| |
518 | 525 |
| |
519 | 526 |
| |
520 | 527 |
| |
521 |
| - | |
| 528 | + | |
522 | 529 |
| |
523 | 530 |
| |
524 |
| - | |
| 531 | + | |
525 | 532 |
| |
526 | 533 |
| |
527 |
| - | |
| 534 | + | |
528 | 535 |
| |
529 | 536 |
| |
530 | 537 |
| |
531 | 538 |
| |
532 | 539 |
| |
533 | 540 |
| |
534 | 541 |
| |
535 |
| - | |
| 542 | + | |
536 | 543 |
| |
537 | 544 |
| |
538 | 545 |
| |
| |||
969 | 976 |
| |
970 | 977 |
| |
971 | 978 |
| |
972 |
| - | |
973 |
| - | |
974 |
| - | |
975 |
| - | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
976 | 987 |
| |
977 | 988 |
| |
978 | 989 |
| |
| |||
986 | 997 |
| |
987 | 998 |
| |
988 | 999 |
| |
989 |
| - | |
990 |
| - | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
991 | 1004 |
| |
992 | 1005 |
| |
993 | 1006 |
| |
| |||
997 | 1010 |
| |
998 | 1011 |
| |
999 | 1012 |
| |
1000 |
| - | |
| 1013 | + | |
1001 | 1014 |
| |
1002 | 1015 |
| |
1003 | 1016 |
| |
| |||
1009 | 1022 |
| |
1010 | 1023 |
| |
1011 | 1024 |
| |
1012 |
| - | |
| 1025 | + | |
1013 | 1026 |
| |
1014 | 1027 |
| |
1015 | 1028 |
| |
| |||
1084 | 1097 |
| |
1085 | 1098 |
| |
1086 | 1099 |
| |
1087 |
| - | |
| 1100 | + | |
1088 | 1101 |
| |
1089 | 1102 |
| |
1090 | 1103 |
| |
| |||
1177 | 1190 |
| |
1178 | 1191 |
| |
1179 | 1192 |
| |
1180 |
| - | |
| 1193 | + | |
1181 | 1194 |
| |
1182 | 1195 |
| |
1183 | 1196 |
| |
1184 | 1197 |
| |
1185 | 1198 |
| |
1186 | 1199 |
| |
1187 |
| - | |
| 1200 | + | |
1188 | 1201 |
| |
1189 | 1202 |
| |
1190 | 1203 |
| |
|
0 commit comments
Comments
(0)