summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 306e267856..c8207886f3 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -302,7 +302,7 @@ do_checksum(argc, argv, func)
/*
* call-seq: Zlib.adler32(string, adler)
*
- * Calculates Alder-32 checksum for +string+, and returns updated value of
+ * Calculates Adler-32 checksum for +string+, and returns updated value of
* +adler+. If +string+ is omitted, it returns the Adler-32 initial value. If
* +adler+ is omitted, it assumes that the initial value is given to +adler+.
*
@@ -733,6 +733,9 @@ zstream_run(z, src, len, flush)
}
for (;;) {
+ /* VC allocates err and guard to same address. accessing err and guard
+ in same scope prevents it. */
+ RB_GC_GUARD(guard);
n = z->stream.avail_out;
err = z->func->run(&z->stream, flush);
z->buf_filled += n - z->stream.avail_out;
@@ -1374,6 +1377,7 @@ rb_deflate_params(obj, v_level, v_strategy)
level = ARG_LEVEL(v_level);
strategy = ARG_STRATEGY(v_strategy);
+ zstream_run(z, (Bytef*)"", 0, Z_SYNC_FLUSH);
err = deflateParams(&z->stream, level, strategy);
while (err == Z_BUF_ERROR) {
rb_warning("deflateParams() returned Z_BUF_ERROR");