[#7102] Ruby 1.3.4-990611 — Yukihiro Matsumoto <matz@...>

Ruby 1.3.4-990611 is out, check out:

20 messages 1999/06/11

[#7223] Ruby 1.3.4-990625 — Yukihiro Matsumoto <matz@...>

Ruby 1.3.4-990625 is out, check out:

14 messages 1999/06/25
[#7224] -Wl,-rpath on Linux (Re: Ruby 1.3.4-990625) — Ryo HAYASAKA <hayasaka@...21.u-aizu.ac.jp> 1999/06/25

早坂@会津大学です。

[ruby-dev:7132] EOF during Marshal.load

From: Masaki Fukushima <fukusima@...>
Date: 1999-06-18 06:29:55 UTC
List: ruby-dev #7132
福嶋です。

Marshal.load に対して、EOFに達しているIOを渡すと、

  old marshal file format (can't read) (TypeError)

という例外が発生しますが、以下のようにした方が分かり易いのではな
いでしょうか。

Index: marshal.c
===================================================================
RCS file: /home/cvs/ruby/marshal.c,v
retrieving revision 1.1.1.2.2.6
diff -u -r1.1.1.2.2.6 marshal.c
--- marshal.c	1999/06/09 09:21:15	1.1.1.2.2.6
+++ marshal.c	1999/06/18 06:27:51
@@ -838,6 +838,9 @@
     }
 
     major = r_byte(&arg);
+    if (major == EOF) {
+	rb_eof_error();
+    }
     if (major == MARSHAL_MAJOR) {
 	if (r_byte(&arg) != MARSHAL_MINOR) {
 	    rb_warn("Old marshal file format (can be read)");

---
福嶋正機

In This Thread

Prev Next