diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 3 | ||||
-rw-r--r-- | test/ruby/test_literal.rb | 2 |
3 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Mon Oct 4 12:43:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (regexp): dregexp has literal string only at the head + and successors are array. [ruby-core:32682] + Mon Oct 4 10:22:21 2010 NARUSE, Yui <naruse@ruby-lang.org> * random.c (rand_init): This checks the value is in 32bit or not, @@ -3897,7 +3897,8 @@ regexp : tREGEXP_BEG regexp_contents tREGEXP_END if (nd_type(list->nd_head) == NODE_STR) { VALUE tail = list->nd_head->nd_lit; if (reg_fragment_check(tail, options) && prev && !NIL_P(prev->nd_lit)) { - if (!literal_concat0(parser, prev->nd_lit, tail)) { + VALUE lit = prev == node ? prev->nd_lit : prev->nd_head->nd_lit; + if (!literal_concat0(parser, lit, tail)) { node = 0; break; } diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index 71fcf49eff..315fe529ea 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -110,6 +110,8 @@ class TestRubyLiteral < Test::Unit::TestCase def test_dregexp assert_instance_of Regexp, /re#{'ge'}xp/ assert_equal(/regexp/, /re#{'ge'}xp/) + bug3903 = '[ruby-core:32682]' + assert_raise(SyntaxError, bug3903) {eval('/[#{"\x80"}]/')} end def test_array |