[前][次][番号順一覧][スレッド一覧]

ruby-changes:11437

From: knu <ko1@a...>
Date: Tue, 24 Mar 2009 17:11:14 +0900 (JST)
Subject: [ruby-changes:11437] Ruby:r23061 (trunk): * io.c (rb_io_inspect): Cannot access fptr->fd if fptr is NULL.

knu	2009-03-24 17:11:01 +0900 (Tue, 24 Mar 2009)

  New Revision: 23061

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23061

  Log:
    * io.c (rb_io_inspect): Cannot access fptr->fd if fptr is NULL.
      This fixes a coredump caused by: ruby -e "class X < IO; def
      initialize; end; end; p X.new.inspect"

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23060)
+++ ChangeLog	(revision 23061)
@@ -1,3 +1,9 @@
+Tue Mar 24 17:08:52 2009  Akinori MUSHA  <knu@i...>
+
+	* io.c (rb_io_inspect): Cannot access fptr->fd if fptr is NULL.
+	  This fixes a coredump caused by: ruby -e "class X < IO; def
+	  initialize; end; end; p X.new.inspect"
+
 Mon Mar 23 22:01:00 2009  Tanaka Akira  <akr@f...>
 
 	* time.c (time_timespec): use NUM2TIMET.
Index: io.c
===================================================================
--- io.c	(revision 23060)
+++ io.c	(revision 23061)
@@ -1387,8 +1387,9 @@
     const char *st = "";
 
     fptr = RFILE(rb_io_taint_check(obj))->fptr;
+    if (!fptr) return rb_any_to_s(obj);
     cname = rb_obj_classname(obj);
-    if (!fptr || NIL_P(fptr->pathv)) {
+    if (NIL_P(fptr->pathv)) {
         if (fptr->fd < 0) {
             path = "";
             st = "(closed)";

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]