diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-18 07:37:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-18 07:37:01 +0000 |
commit | 178f5aca22849a1bad841d0e8c69d5dc9d0102cd (patch) | |
tree | 5e08e2ec57d1900694ed07d62fb1fc4806ba27f2 /ext/zlib | |
parent | 3cebc7cc3dd4142637c8555d4891ec3884bf3435 (diff) | |
download | ruby-178f5aca22849a1bad841d0e8c69d5dc9d0102cd.tar.gz ruby-178f5aca22849a1bad841d0e8c69d5dc9d0102cd.tar.xz ruby-178f5aca22849a1bad841d0e8c69d5dc9d0102cd.zip |
* ext/zlib/zlib.c (rb_deflate_s_deflate, rb_inflate_s_inflate):
disallow interrupt by type conversion. fixed: [ruby-dev:25226]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/zlib.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 6dfb4cb4b..1a664fd40 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1202,18 +1202,19 @@ rb_deflate_s_deflate(argc, argv, klass) { struct zstream z; VALUE src, level, dst; - int err; + int err, lev; rb_scan_args(argc, argv, "11", &src, &level); + lev = ARG_LEVEL(level); + StringValue(src); zstream_init_deflate(&z); - err = deflateInit(&z.stream, ARG_LEVEL(level)); + err = deflateInit(&z.stream, lev); if (err != Z_OK) { raise_zlib_error(err, z.stream.msg); } ZSTREAM_READY(&z); - StringValue(src); zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_FINISH); dst = zstream_detach_buffer(&z); zstream_end(&z); @@ -1454,6 +1455,7 @@ rb_inflate_s_inflate(obj, src) VALUE dst; int err; + StringValue(src); zstream_init_inflate(&z); err = inflateInit(&z.stream); if (err != Z_OK) { @@ -1461,7 +1463,6 @@ rb_inflate_s_inflate(obj, src) } ZSTREAM_READY(&z); - StringValue(src); zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_SYNC_FLUSH); zstream_run(&z, "", 0, Z_FINISH); /* for checking errors */ dst = zstream_detach_buffer(&z); |