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

ruby-changes:32740

From: naruse <ko1@a...>
Date: Wed, 5 Feb 2014 11:35:25 +0900 (JST)
Subject: [ruby-changes:32740] naruse:r44819 (ruby_2_1): merge revision(s) 44803: [Backport #9478]

naruse	2014-02-05 11:35:13 +0900 (Wed, 05 Feb 2014)

  New Revision: 44819

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

  Log:
    merge revision(s) 44803: [Backport #9478]
    
    * string.c (rb_str_modify_expand): enable capacity and disable
      assocation with packed objects when setting capa, so that
      pack("p") string fails to unpack properly after modified.

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/string.c
    branches/ruby_2_1/test/ruby/test_pack.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 44818)
+++ ruby_2_1/ChangeLog	(revision 44819)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Wed Feb  5 11:13:21 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (rb_str_modify_expand): enable capacity and disable
+	  assocation with packed objects when setting capa, so that
+	  pack("p") string fails to unpack properly after modified.
+
 Sun Feb  2 22:39:28 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/delegate.rb (Delegator): keep source information methods
Index: ruby_2_1/string.c
===================================================================
--- ruby_2_1/string.c	(revision 44818)
+++ ruby_2_1/string.c	(revision 44819)
@@ -1465,6 +1465,7 @@ rb_str_modify_expand(VALUE str, long exp https://github.com/ruby/ruby/blob/trunk/ruby_2_1/string.c#L1465
 	int termlen = TERM_LEN(str);
 	if (!STR_EMBED_P(str)) {
 	    REALLOC_N(RSTRING(str)->as.heap.ptr, char, capa + termlen);
+	    STR_UNSET_NOCAPA(str);
 	    RSTRING(str)->as.heap.aux.capa = capa;
 	}
 	else if (capa + termlen > RSTRING_EMBED_LEN_MAX + 1) {
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 44818)
+++ ruby_2_1/version.h	(revision 44819)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.1"
-#define RUBY_RELEASE_DATE "2014-02-02"
-#define RUBY_PATCHLEVEL 15
+#define RUBY_RELEASE_DATE "2014-02-05"
+#define RUBY_PATCHLEVEL 16
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 2
+#define RUBY_RELEASE_DAY 5
 
 #include "ruby/version.h"
 
Index: ruby_2_1/test/ruby/test_pack.rb
===================================================================
--- ruby_2_1/test/ruby/test_pack.rb	(revision 44818)
+++ ruby_2_1/test/ruby/test_pack.rb	(revision 44819)
@@ -181,6 +181,7 @@ class TestPack < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_pack.rb#L181
     assert_equal a[0], a.pack("p").unpack("p")[0]
     assert_equal a, a.pack("p").freeze.unpack("p*")
     assert_raise(ArgumentError) { (a.pack("p") + "").unpack("p*") }
+    assert_raise(ArgumentError) { (a.pack("p") << "d").unpack("p*") }
   end
 
   def test_format_string_modified

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44803


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

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