From fd9847c808c421a201ae574d93f6d0ea36d9ec63 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 15 Jul 2018 00:58:37 +0000 Subject: Mwrap.dump: do not segfault on invalid IO arg Users may screw up ordering of arguments :x --- ext/mwrap/mwrap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/mwrap/mwrap.c') diff --git a/ext/mwrap/mwrap.c b/ext/mwrap/mwrap.c index 3f59f11..c160e33 100644 --- a/ext/mwrap/mwrap.c +++ b/ext/mwrap/mwrap.c @@ -346,6 +346,7 @@ static VALUE mwrap_dump(int argc, VALUE * argv, VALUE mod) io = *((VALUE *)dlsym(RTLD_DEFAULT, "rb_stderr")); a.min = NIL_P(min) ? 0 : NUM2SIZET(min); + io = rb_io_get_io(io); io = rb_io_get_write_io(io); GetOpenFile(io, fptr); a.fp = rb_io_stdio_file(fptr); -- cgit v1.2.3-24-ge0c7