From 549e0e488eba4c7710cf5b63d6e319415244bf60 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 18 Apr 2014 11:46:02 +0000 Subject: 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 --- ext/zlib/zlib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ext/zlib') diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 824dd1324a..db09af68fe 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -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); -- cgit v1.2.3