summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNAKAMURA Usaku <usa@ruby-lang.org>2021-12-31 19:48:29 +0900
committerNAKAMURA Usaku <usa@ruby-lang.org>2021-12-31 19:48:29 +0900
commit1cc5567b46249e6b4bd2dd3cfdd348ab885f59e3 (patch)
treed5b0aff37c2abcb0cb230d4bd27b79ea872c5768 /test
parent426266af2cbfba8d42a82abcce1bb3ca6c039e87 (diff)
merge revision(s) 0846c2da457e7523819236ac7da492029b3ef73d,6c7cb00c094332a208cf36e5cd723a9ba60c41b8: [Backport #16376]
Check backref number buffer overrun [Bug #16376] --- regcomp.c | 21 ++++++++++++--------- test/ruby/test_regexp.rb | 6 ++++++ 2 files changed, 18 insertions(+), 9 deletions(-) test/ruby/test_regexp.rb: Avoid "ambiguity between regexp and two divisions" --- test/ruby/test_regexp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_regexp.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 5c7d205185..8709d05752 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1293,6 +1293,12 @@ class TestRegexp < Test::Unit::TestCase
assert_nil($1)
end
+ def test_backref_overrun
+ assert_raise_with_message(SyntaxError, /invalid backref number/) do
+ eval(%["".match(/(())(?<X>)((?(90000)))/)])
+ end
+ end
+
# This assertion is for porting x2() tests in testpy.py of Onigmo.
def assert_match_at(re, str, positions, msg = nil)
re = Regexp.new(re) unless re.is_a?(Regexp)