summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regexec.c2
-rwxr-xr-xt/op/pat.t9
2 files changed, 9 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index 13832311c7..f620a3485d 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2425,7 +2425,7 @@ S_regmatch(pTHX_ regnode *prog)
sayNO_ANYOF;
if (locinput >= PL_regeol)
sayNO;
- locinput += inclasslen;
+ locinput += inclasslen ? inclasslen : 1;
nextchr = UCHARAT(locinput);
break;
}
diff --git a/t/op/pat.t b/t/op/pat.t
index 4fb3d45e5e..67ca7659ad 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -6,7 +6,7 @@
$| = 1;
-print "1..860\n";
+print "1..861\n";
BEGIN {
chdir 't' if -d 't';
@@ -2706,3 +2706,10 @@ print "# some Unicode properties\n";
$i++;
}
}
+
+{
+ print "# SEGV in s/// and UTF-8\n";
+ $s = "s#\x{100}" x 4;
+ $s =~ s/[^\w]/ /g;
+ print $s eq "s \x{100}" x 4 ? "ok 861\n" : "not ok 861\n";
+}