summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 04:43:40 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 04:43:40 +0000
commitb6a4e7cea087b176ac82f2cb3fb3f9812a418f40 (patch)
tree74352aed8617258dd89563d71cf09f9f271acdba /string.c
parent13848d6048d7518bd69e2b6f6b72bffaac531032 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@44830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/string.c b/string.c
index 389a5559ce..8f692b41af 100644
--- a/string.c
+++ b/string.c
@@ -1337,6 +1337,7 @@ rb_str_modify_expand(VALUE str, long expand)
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) {