Permalink
Browse files

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.
  • Loading branch information...
1 parent 203979c commit 1380b51d3b2bb6a067c4a2a3eebbe18650487023 @iabyn iabyn committed Aug 5, 2011
Showing with 13 additions and 1 deletion.
  1. +4 −0 regexec.c
  2. +9 −1 t/re/re_tests
View
@@ -5683,13 +5683,17 @@ NULL
#define CASE_CLASS(nAmE) \
case nAmE: \
+ if (locinput >= PL_regeol) \
+ sayNO; \
if ((n=is_##nAmE(locinput,utf8_target))) { \
locinput += n; \
nextchr = UCHARAT(locinput); \
} else \
sayNO; \
break; \
case N##nAmE: \
+ if (locinput >= PL_regeol) \
+ sayNO; \
if ((n=is_##nAmE(locinput,utf8_target))) { \
sayNO; \
} else { \
View
@@ -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

0 comments on commit 1380b51

Please sign in to comment.