summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-01-18 14:05:23 -0700
committerKarl Williamson <khw@cpan.org>2018-01-30 22:12:46 -0700
commit13d9cfd2bcbeb126d5df43533bf52c9df1ba3960 (patch)
tree13257ca4e1ecfb2bbe55c102fd20212c83dfcc2c
parenteac3f4d5c7d71a1a3a22818c6bcc9c32b312eb40 (diff)
downloadperl-13d9cfd2bcbeb126d5df43533bf52c9df1ba3960.tar.gz
Fix bug in isSCRIPT_RUN with digit following unassigned
This was being treated as a run, but shouldn't be one.
-rw-r--r--regexec.c4
-rw-r--r--t/re/script_run.t1
2 files changed, 5 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index 1cd61de812..b41f680258 100644
--- 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;
diff --git a/t/re/script_run.t b/t/re/script_run.t
index b892d757a7..a1b877efa1 100644
--- a/t/re/script_run.t
+++ b/t/re/script_run.t
@@ -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");