1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

zlib.c: return unshared string

* ext/zlib/zlib.c (zstream_shift_buffer): create new copied string
  since it cannot be shared ever.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-04-18 11:46:02 +00:00
parent 39fe6aa304
commit 549e0e488e

View file

@ -814,8 +814,7 @@ zstream_shift_buffer(struct zstream *z, long len)
return zstream_detach_buffer(z);
}
dst = rb_str_subseq(z->buf, 0, len);
rb_obj_reveal(dst, rb_cString);
dst = rb_str_new(RSTRING_PTR(z->buf), len);
z->buf_filled -= len;
memmove(RSTRING_PTR(z->buf), RSTRING_PTR(z->buf) + len,
z->buf_filled);