summaryrefslogtreecommitdiff
path: root/t/re/re_tests
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2014-02-25 12:07:18 +0100
committerYves Orton <demerphq@gmail.com>2014-02-25 12:10:22 +0100
commit845ab12d77c07580053486e445977dc895d747f8 (patch)
tree1edfcdec11566971fa28dfab50c6edf808f1e14d /t/re/re_tests
parent313e09e70abdc9a57e7f4b1a814b5bddc652fcf4 (diff)
downloadperl-845ab12d77c07580053486e445977dc895d747f8.tar.gz
Fix RT #121321 - Fencepost error causes infinite loop in regex compilation
Due to a fencepost error if a pattern had more than 9 capture buffers and after the last capture buffer there was an octal style escape which when interpreted as decimal evaluated to one more than the number of defined buffers then the regex compiler would go into an infinite loop. This fixes the fencepost error, adds tests, and adds some comments to explain what is going on.
Diffstat (limited to 't/re/re_tests')
-rw-r--r--t/re/re_tests12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/re/re_tests b/t/re/re_tests
index ab867f5ede..44e94c7245 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1867,5 +1867,17 @@ A+(*PRUNE)BC(?{}) AAABC y $& AAABC
/^(.\1?)(?1)$/ aba y $1 a
/^ (\3(?2)\3)? ((.)) (?1) $/x aaba y $2 a
/^ (a|\3(?1)\2|(?2)) ((b|c)(?4)?) (?1) (d(?1)) $/x abbcdcabbda y $2 b
+
+# RT #121321 - perl 5.19.10 infinite loops on backrefs > number of capture buffers (npar) where npar>9
+/(a)\2/ a\2 c - Reference to nonexistent group in regex
+/(a)(b)\3/ ab\3 c - Reference to nonexistent group in regex
+/(a)(b)(c)\4/ abc\4 c - Reference to nonexistent group in regex
+/(a)(b)(c)(d)\5/ abcd\5 c - Reference to nonexistent group in regex
+/(a)(b)(c)(d)(e)\6/ abcde\6 c - Reference to nonexistent group in regex
+/(a)(b)(c)(d)(e)(f)\7/ abcdef\7 c - Reference to nonexistent group in regex
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)\10/ abcdefghi\10 y $& abcdefghi\10
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)\11/ abcdefghij\11 y $& abcdefghij\11
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12/ abcdefghijk\12 y $& abcdefghijk\12
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\13\14/ abcdefghijk\12\13\14 y $& abcdefghijk\12\13\14
# Keep these lines at the end of the file
# vim: softtabstop=0 noexpandtab