This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: #17196, Assertion failure in /l pattern
authorKarl Williamson <khw@cpan.org>
Tue, 22 Oct 2019 14:00:28 +0000 (08:00 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 22 Oct 2019 14:05:06 +0000 (08:05 -0600)
This was from an earlier change that modified some logic without paying
sufficient attention to the consequences of those modifications.

regcomp.c
t/re/pat.t

index f007d90..8d19874 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -14662,7 +14662,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
 
                 goto continue_parse;
             }
-            else {
+            else if (! LOC) {
 
                 /* Here is /i.  Running out of room creates a problem if we are
                  * folding, and the split happens in the middle of a
index b046638..0a0b1f0 100644 (file)
@@ -25,7 +25,7 @@ BEGIN {
 skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader;
 skip_all_without_unicode_tables();
 
-plan tests => 965;  # Update this when adding/deleting tests.
+plan tests => 966;  # Update this when adding/deleting tests.
 
 run_tests() unless caller;
 
@@ -2199,6 +2199,13 @@ x{0c!}\;\;îçÿ \0\7f/0f/!\0F\ 5\0\0/;îçÿù\Q\0\ 1\0\0x\10ÿÿÿÿ\0\0\0ù\0\0\0\7f`x{0c!}\ 1;\0\0\0ù\Q
         like(runperl(prog => "$s", stderr => 1), qr/Unmatched \(/);
    }
 
+   {    # GitHub #17196, caused assertion failure
+        fresh_perl_like('("0" x 258) =~ /(?l)0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/',
+                        qr/^$/,
+                        {},
+                        "Assertion failure with /l exact string longer than a single node");
+    }
+
 } # End of sub run_tests
 
 1;