summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-08-05 17:46:46 +0100
committerDavid Mitchell <davem@iabyn.com>2011-08-05 17:49:51 +0100
commit1380b51d3b2bb6a067c4a2a3eebbe18650487023 (patch)
tree77a135c7c65673512544b1487c9b525bc05833a1
parent203979cd3f6e5fc2c4039fbd225bbbc4c1bb8f84 (diff)
downloadperl-1380b51d3b2bb6a067c4a2a3eebbe18650487023.tar.gz
RT #96354: \h \H \v and \V didn't check for EOL
The HORIZWS and similar regexp ops didn't check that the end of the string had been reached; therefore they would blithely compare against the \0 at the end of the string, or beyond.
-rw-r--r--regexec.c4
-rw-r--r--t/re/re_tests10
2 files changed, 13 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 76c91af1f7..bdd5e3faed 100644
--- a/regexec.c
+++ b/regexec.c
@@ -5683,6 +5683,8 @@ NULL
#define CASE_CLASS(nAmE) \
case nAmE: \
+ if (locinput >= PL_regeol) \
+ sayNO; \
if ((n=is_##nAmE(locinput,utf8_target))) { \
locinput += n; \
nextchr = UCHARAT(locinput); \
@@ -5690,6 +5692,8 @@ NULL
sayNO; \
break; \
case N##nAmE: \
+ if (locinput >= PL_regeol) \
+ sayNO; \
if ((n=is_##nAmE(locinput,utf8_target))) { \
sayNO; \
} else { \
diff --git a/t/re/re_tests b/t/re/re_tests
index 35a72203cd..978e02c1dd 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1,7 +1,10 @@
# This stops me getting screenfulls of syntax errors every time I accidentally
-# run this file via a shell glob. Format of this file is given in regexp.t
+# run this file via a shell glob. The full format of this file is given
+# in regexp.t
# Can't use \N{VALID NAME TEST} here because need 'use charnames'; but can use
# \N{U+valid} here.
+#
+# pat string y/n/etc expr expected-expr skip-reason
__END__
abc abc y $& abc
abc abc y $-[0] 0
@@ -1522,4 +1525,9 @@ abc\N{def - c - \\N{NAME} must be resolved by the lexer
# See [perl #89750]. This makes sure that the simple fold gets generated
# in that case, to DF.
/[^\x{1E9E}]/i \x{DF} n - -
+
+# RT #96354
+/^.*\d\H/ X1 n - -
+/^.*\d\V/ X1 n - -
+
# vim: softtabstop=0 noexpandtab