ruby-changes:32926
From: nagachika <ko1@a...>
Date: Mon, 17 Feb 2014 00:54:53 +0900 (JST)
Subject: [ruby-changes:32926] nagachika:r45005 (ruby_2_0_0): merge revision(s) r44803: [Backport #9484]
nagachika 2014-02-17 00:54:46 +0900 (Mon, 17 Feb 2014) New Revision: 45005 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45005 Log: merge revision(s) r44803: [Backport #9484] * 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_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/string.c branches/ruby_2_0_0/test/ruby/test_pack.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 45004) +++ ruby_2_0_0/ChangeLog (revision 45005) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Mon Feb 17 00:45:44 2014 Nobuyoshi Nakada <nobu@r...> + + * string.c (rb_str_modify_expand): enable capacity and disable + association with packed objects when setting capa, so that + pack("p") string fails to unpack properly after modified. + Sun Feb 16 01:36:57 2014 Aaron Patterson <aaron@t...> * ext/psych/yaml/emitter.c: merge libyaml 0.1.5 Index: ruby_2_0_0/string.c =================================================================== --- ruby_2_0_0/string.c (revision 45004) +++ ruby_2_0_0/string.c (revision 45005) @@ -1387,6 +1387,7 @@ rb_str_modify_expand(VALUE str, long exp https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/string.c#L1387 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_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 45004) +++ ruby_2_0_0/version.h (revision 45005) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2014-02-16" -#define RUBY_PATCHLEVEL 423 +#define RUBY_RELEASE_DATE "2014-02-17" +#define RUBY_PATCHLEVEL 424 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 16 +#define RUBY_RELEASE_DAY 17 #include "ruby/version.h" Index: ruby_2_0_0/test/ruby/test_pack.rb =================================================================== --- ruby_2_0_0/test/ruby/test_pack.rb (revision 45004) +++ ruby_2_0_0/test/ruby/test_pack.rb (revision 45005) @@ -181,6 +181,7 @@ class TestPack < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/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_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r44803 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/