diff --git a/ChangeLog b/ChangeLog index 8b00649ab2..7d83143ac2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Oct 29 10:00:30 2004 Yukihiro Matsumoto + + * eval.c (ruby_cleanup): ruby_finalize_1 may cause exception, + should be wrapped by PUSH_TAG/POP_TAG(). [ruby-dev:24627] + Wed Oct 27 09:17:30 2004 Nobuyoshi Nakada * string.c (str_gsub): use a string object for exception safeness. diff --git a/eval.c b/eval.c index cc5194d4c5..1f9d9375dd 100644 --- a/eval.c +++ b/eval.c @@ -1430,9 +1430,9 @@ ruby_cleanup(ex) POP_ITER(); ruby_errinfo = err; ex = error_handle(ex); + ruby_finalize_1(); POP_TAG(); - ruby_finalize_1(); if (err && rb_obj_is_kind_of(err, rb_eSystemExit)) { VALUE st = rb_iv_get(err, "status"); return NUM2INT(st); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 21bcfbcff8..db3b6c8ed6 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -640,7 +640,13 @@ zstream_detach_input(z) { VALUE dst; - dst = NIL_P(z->input) ? rb_str_new(0, 0) : z->input; + if (NIL_P(z->input)) { + dst = rb_str_new(0, 0); + } + else { + dst = z->input; + RBASIC(dst)->klass = rb_cString; + } z->input = Qnil; RBASIC(dst)->klass = rb_cString; return dst; diff --git a/io.c b/io.c index bef487f3a9..414e70e413 100644 --- a/io.c +++ b/io.c @@ -4131,8 +4131,8 @@ rb_io_s_for_fd(argc, argv, klass) static int binmode = 0; static VALUE -argf_forward(argv) - VALUE *argv; +argf_forward( + VALUE *argv) { return rb_funcall3(current_file, ruby_frame->last_func, ruby_frame->argc, argv); } @@ -5224,7 +5224,7 @@ argf_read(argc, argv) return str; } if (TYPE(current_file) != T_FILE) { - tmp = argf_forward(); + tmp = argf_forward(argv); } else { tmp = io_read(argc, argv, current_file); diff --git a/lib/cgi.rb b/lib/cgi.rb index afc99ab7ca..9f3f7c0e04 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -1023,7 +1023,7 @@ class CGI content_length -= c.size end - buf = buf.sub(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|--)/n) do + buf = buf.sub(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|#{LF}|--)/n) do body.print $1 if "--" == $2 content_length = -1