summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog4
-rw-r--r--vm_backtrace.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 172e74e..c35417a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Dec 3 16:23:09 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c (vm_backtrace_to_ary): check negative size (2nd arg).
+
Mon Dec 3 15:50:33 2012 Akinori MUSHA <knu@iDaemons.org>
* misc/ruby-additional.el (ruby-mode-set-encoding): Unbreak by
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 */