Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

need to allocate buffer area in zstream_expand_buffer_into() even if …

…size is less than or equal to 0
  • Loading branch information...
commit 15a853a3969e69d4ad0b643ebeb5bcc133ff9356 1 parent bd66999
@Watson1978 Watson1978 authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 ext/zlib/zlib.c
View
7 ext/zlib/zlib.c
@@ -474,7 +474,12 @@ zstream_expand_buffer_into(struct zstream *z, int size)
{
if (NIL_P(z->buf)) {
GC_WB(&z->buf, rb_bstr_new());
- rb_bstr_resize(z->buf, size);
+ if (size <= 0) {
+ rb_bstr_resize(z->buf, 1);
+ }
+ else {
+ rb_bstr_resize(z->buf, size);
+ }
z->buf_filled = 0;
z->stream.next_out = BSTRING_PTR_BYTEF(z->buf);
z->stream.avail_out = size;
Please sign in to comment.
Something went wrong with that request. Please try again.