This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix bug in isSCRIPT_RUN with digit following unassigned
authorKarl Williamson <khw@cpan.org>
Thu, 18 Jan 2018 21:05:23 +0000 (14:05 -0700)
committerKarl Williamson <khw@cpan.org>
Wed, 31 Jan 2018 05:12:46 +0000 (22:12 -0700)
This was being treated as a run, but shouldn't be one.

regexec.c
t/re/script_run.t

index 1cd61de..b41f680 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -10394,6 +10394,10 @@ Perl_isSCRIPT_RUN(pTHX_ const U8 * s, const U8 * send, const bool utf8_target, S
          * another set has already been encountered.  (The other digit ranges
          * in Common are not similarly blessed) */
         if (UNLIKELY(isDIGIT(*s))) {
+            if (UNLIKELY(script_of_run == SCX_Unknown)) {
+                retval = FALSE;
+                break;
+            }
             if (zero_of_run > 0) {
                 if (zero_of_run != '0') {
                     retval = FALSE;
index b892d75..a1b877e 100644 (file)
@@ -62,6 +62,7 @@ like("\N{U+03A2}", $script_run, "A single unassigned code point is a script run"
 unlike("\N{U+03A2}\N{U+03A2}", $script_run, "But not more than one");
 unlike("A\N{U+03A2}", $script_run, "... and not in combination with an assigned one");
 unlike("\N{U+03A2}A", $script_run, "... in either order");
+unlike("\N{U+03A2}0", $script_run, "... nor with a digit following");
 
 like("A\N{COMBINING GRAVE ACCENT}", $script_run, "An inherited script matches others");
 like("\N{COMBINING GRAVE ACCENT}A", $script_run, "... even if first in the sequence");