From 2976ec58a48e3ff83ff3d0979041bb5694592153 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 21 Apr 2010 04:44:58 +0000 Subject: * parse.y (regexp): check each fragments. [ruby-core:27374] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_regexp.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 1ef1380078..35f23685eb 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -477,7 +477,7 @@ class TestRegexp < Test::Unit::TestCase end.value assert(m.tainted?) assert_nothing_raised('[ruby-core:26137]') { - m = proc {$SAFE = 4; %r"#{}"o}.call + m = proc {$SAFE = 4; %r"#{ }"o}.call } assert(m.tainted?) end @@ -807,4 +807,9 @@ class TestRegexp < Test::Unit::TestCase assert_equal("1", $1) assert_equal(" " * 4999999, $2) end + + def test_invalid_fragment + bug2547 = '[ruby-core:27374]' + assert_raise(SyntaxError, bug2547) {eval('/#{"\\\\"}y/')} + end end -- cgit v1.2.3