From fe7ec526f398671fb079ad30dda413d2fcf17bc1 Mon Sep 17 00:00:00 2001 From: eregon Date: Wed, 13 Jun 2018 21:17:48 +0000 Subject: Fix condition in Kernel#warn when using uplevel * It causes SEGV on `warn("foo", uplevel: 100)`. * Found in a ruby/spec added by @andrykonchin in https://github.com/ruby/spec/pull/605 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/error.c b/error.c index a18583fad4..05bb070e53 100644 --- a/error.c +++ b/error.c @@ -371,7 +371,7 @@ rb_warn_m(int argc, VALUE *argv, VALUE exc) args[0] = LONG2NUM(lev + 1); args[1] = INT2FIX(1); location = rb_vm_thread_backtrace_locations(2, args, GET_THREAD()->self); - if (!NIL_P(uplevel)) { + if (!NIL_P(location)) { location = rb_ary_entry(location, 0); } } -- cgit v1.2.3