diff options
| author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-24 08:11:01 +0000 |
|---|---|---|
| committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-24 08:11:01 +0000 |
| commit | 6a15f27070c257ef39d93d50591fac1cfa7ae745 (patch) | |
| tree | 0889cd2656b987b879e0fd73d67de9ca7ea715da | |
| parent | 6cea2ba83ebd3036bd79707b58c5d18e34ebb1b7 (diff) | |
| download | ruby-6a15f27070c257ef39d93d50591fac1cfa7ae745.tar.gz ruby-6a15f27070c257ef39d93d50591fac1cfa7ae745.tar.xz ruby-6a15f27070c257ef39d93d50591fac1cfa7ae745.zip | |
* 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"
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | io.c | 3 |
2 files changed, 8 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Tue Mar 24 17:08:52 2009 Akinori MUSHA <knu@iDaemons.org> + + * 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@fsij.org> * time.c (time_timespec): use NUM2TIMET. @@ -1387,8 +1387,9 @@ rb_io_inspect(VALUE obj) 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)"; |
