This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Add assertion
authorKarl Williamson <khw@cpan.org>
Fri, 22 Nov 2019 22:31:51 +0000 (15:31 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 22 Nov 2019 22:54:44 +0000 (15:54 -0700)
This will catch illegal things a little earlier.

regcomp.c

index bb3cd66..0d47769 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -20326,6 +20326,7 @@ S_regtail(pTHX_ RExC_state_t * pRExC_state,
         scan = REGNODE_OFFSET(temp);
     }
 
+    assert(val >= scan);
     if (reg_off_by_arg[OP(REGNODE_p(scan))]) {
         assert((UV) (val - scan) <= U32_MAX);
         ARG_SET(REGNODE_p(scan), val - scan);