[前][次][番号順一覧][スレッド一覧]

ruby-changes:35892

From: nobu <ko1@a...>
Date: Thu, 16 Oct 2014 15:05:18 +0900 (JST)
Subject: [ruby-changes:35892] nobu:r47973 (trunk): parse.y: do not use disposed string

nobu	2014-10-16 15:05:03 +0900 (Thu, 16 Oct 2014)

  New Revision: 47973

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47973

  Log:
    parse.y: do not use disposed string
    
    * parse.y (parser_here_document): do not append already appended
      and disposed code fragment.  [ruby-dev:48647] [Bug #10392]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ripper/test_scanner_events.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47972)
+++ ChangeLog	(revision 47973)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Oct 16 15:05:07 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (parser_here_document): do not append already appended
+	  and disposed code fragment.  [ruby-dev:48647] [Bug #10392]
+
 Thu Oct 16 10:35:33 2014  Eric Wong  <e@8...>
 
 	* test/-ext-/bug_reporter/test_bug_reporter.rb
Index: parse.y
===================================================================
--- parse.y	(revision 47972)
+++ parse.y	(revision 47973)
@@ -6575,7 +6575,10 @@ parser_here_document(struct parser_param https://github.com/ruby/ruby/blob/trunk/parse.y#L6575
 	    if (pend < lex_pend) rb_str_cat(str, "\n", 1);
 	    lex_goto_eol(parser);
 	    if (nextc() == -1) {
-		if (str) dispose_string(str);
+		if (str) {
+		    dispose_string(str);
+		    str = 0;
+		}
 		goto error;
 	    }
 	} while (!whole_match_p(eos, len, indent));
Index: test/ripper/test_scanner_events.rb
===================================================================
--- test/ripper/test_scanner_events.rb	(revision 47972)
+++ test/ripper/test_scanner_events.rb	(revision 47973)
@@ -708,6 +708,10 @@ class TestRipper::ScannerEvents < Test:: https://github.com/ruby/ruby/blob/trunk/test/ripper/test_scanner_events.rb#L708
     assert_equal ["there\n""heredoc", "\n"],
                  scan('tstring_content', "<<""EOS\n""there\n""heredoc\#@foo\nEOS"),
                  bug7255
+    bug10392 = '[ruby-dev:48647] [Bug #10392]'
+    assert_equal [" E\n\n"],
+                 scan('tstring_content', "<<""'E'\n E\n\n"),
+                 bug10392
   end
 
   def test_heredoc_end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]