summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-03 07:23:57 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-03 07:23:57 +0000
commit1d193d9251fb5cc58f1b4ac3346ac63529d63097 (patch)
treee805bc22f24dd3db4394150df364933ccb770118 /vm_backtrace.c
parent9def7828895b4a119bb1504019ea5c7501255272 (diff)
* vm_backtrace.c (vm_backtrace_to_ary): check negative size (2nd arg).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 8e10d6e..3684bcd 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -755,11 +755,14 @@ vm_backtrace_to_ary(rb_thread_t *th, int argc, VALUE *argv, int lev_default, int
}
case 2:
lev = NUM2LONG(level);
+ n = NUM2LONG(vn);
if (lev < 0) {
rb_raise(rb_eArgError, "negative level (%ld)", lev);
}
+ if (n < 0) {
+ rb_raise(rb_eArgError, "negative size (%ld)", n);
+ }
lev += lev_plus;
- n = NUM2LONG(vn);
break;
default:
lev = n = 0; /* to avoid warning */