This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec: disallow zero-width nodes in regrepeat
authorHugo van der Sanden <hv@crypt.org>
Tue, 21 Apr 2020 10:50:18 +0000 (11:50 +0100)
committerHugo van der Sanden <hv@crypt.org>
Thu, 8 Oct 2020 12:11:28 +0000 (13:11 +0100)
GH #17594: the logic here expects the node to have width 1 (except for
LNBREAK), it is not expected to do the right thing on zero-width nodes.

regexec.c

index 47e2833..5d3c465 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -9999,25 +9999,6 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
        }
        break;
 
-    case BOUNDL:
-    case NBOUNDL:
-        _CHECK_AND_WARN_PROBLEMATIC_LOCALE;
-        /* FALLTHROUGH */
-    case BOUND:
-    case BOUNDA:
-    case BOUNDU:
-    case EOS:
-    case GPOS:
-    case KEEPS:
-    case NBOUND:
-    case NBOUNDA:
-    case NBOUNDU:
-    case OPFAIL:
-    case SBOL:
-    case SEOL:
-        /* These are all 0 width, so match right here or not at all. */
-        break;
-
     default:
         Perl_croak(aTHX_ "panic: regrepeat() called with unrecognized node type %d='%s'", OP(p), PL_reg_name[OP(p)]);
         NOT_REACHED; /* NOTREACHED */