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

* ext/zlib/zlib.c (rb_deflate_s_deflate, rb_inflate_s_inflate):

disallow interrupt by type conversion.  fixed: [ruby-dev:25226]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-12-18 07:37:01 +00:00
parent 93ed2c7b1e
commit 9c016c18fc
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Sat Dec 18 16:36:23 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/zlib/zlib.c (rb_deflate_s_deflate, rb_inflate_s_inflate):
disallow interrupt by type conversion. fixed: [ruby-dev:25226]
Sat Dec 18 15:09:02 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp> Sat Dec 18 15:09:02 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/webrick/httpauth.rb, * lib/webrick/httpauth.rb,

View file

@ -1205,18 +1205,19 @@ rb_deflate_s_deflate(argc, argv, klass)
{ {
struct zstream z; struct zstream z;
VALUE src, level, dst; VALUE src, level, dst;
int err; int err, lev;
rb_scan_args(argc, argv, "11", &src, &level); rb_scan_args(argc, argv, "11", &src, &level);
lev = ARG_LEVEL(level);
StringValue(src);
zstream_init_deflate(&z); zstream_init_deflate(&z);
err = deflateInit(&z.stream, ARG_LEVEL(level)); err = deflateInit(&z.stream, lev);
if (err != Z_OK) { if (err != Z_OK) {
raise_zlib_error(err, z.stream.msg); raise_zlib_error(err, z.stream.msg);
} }
ZSTREAM_READY(&z); ZSTREAM_READY(&z);
StringValue(src);
zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_FINISH); zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_FINISH);
dst = zstream_detach_buffer(&z); dst = zstream_detach_buffer(&z);
zstream_end(&z); zstream_end(&z);
@ -1457,6 +1458,7 @@ rb_inflate_s_inflate(obj, src)
VALUE dst; VALUE dst;
int err; int err;
StringValue(src);
zstream_init_inflate(&z); zstream_init_inflate(&z);
err = inflateInit(&z.stream); err = inflateInit(&z.stream);
if (err != Z_OK) { if (err != Z_OK) {
@ -1464,7 +1466,6 @@ rb_inflate_s_inflate(obj, src)
} }
ZSTREAM_READY(&z); ZSTREAM_READY(&z);
StringValue(src);
zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_SYNC_FLUSH); zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_SYNC_FLUSH);
zstream_run(&z, "", 0, Z_FINISH); /* for checking errors */ zstream_run(&z, "", 0, Z_FINISH); /* for checking errors */
dst = zstream_detach_buffer(&z); dst = zstream_detach_buffer(&z);