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

ruby-changes:32751

From: usa <ko1@a...>
Date: Wed, 5 Feb 2014 13:43:45 +0900 (JST)
Subject: [ruby-changes:32751] usa:r44830 (ruby_1_9_3): merge revision(s) 44803: [Backport #9485]

usa	2014-02-05 13:43:40 +0900 (Wed, 05 Feb 2014)

  New Revision: 44830

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

  Log:
    merge revision(s) 44803: [Backport #9485]
    
    * 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_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/string.c
    branches/ruby_1_9_3/test/ruby/test_pack.rb
    branches/ruby_1_9_3/version.h
Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 44829)
+++ ruby_1_9_3/ChangeLog	(revision 44830)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Wed Feb  5 13:43:02 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 05:48:42 2014  Eric Wong <e@8...>
 
 	* io.c (rb_io_syswrite): add RB_GC_GUARD
Index: ruby_1_9_3/string.c
===================================================================
--- ruby_1_9_3/string.c	(revision 44829)
+++ ruby_1_9_3/string.c	(revision 44830)
@@ -1337,6 +1337,7 @@ rb_str_modify_expand(VALUE str, long exp https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/string.c#L1337
 	long capa = len + expand;
 	if (!STR_EMBED_P(str)) {
 	    REALLOC_N(RSTRING(str)->as.heap.ptr, char, capa+1);
+	    STR_UNSET_NOCAPA(str);
 	    RSTRING(str)->as.heap.aux.capa = capa;
 	}
 	else if (capa > RSTRING_EMBED_LEN_MAX) {
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 44829)
+++ ruby_1_9_3/version.h	(revision 44830)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 513
+#define RUBY_PATCHLEVEL 514
 
 #define RUBY_RELEASE_DATE "2014-02-05"
 #define RUBY_RELEASE_YEAR 2014
Index: ruby_1_9_3/test/ruby/test_pack.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_pack.rb	(revision 44829)
+++ ruby_1_9_3/test/ruby/test_pack.rb	(revision 44830)
@@ -180,6 +180,7 @@ class TestPack < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_pack.rb#L180
     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_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44803


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

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