diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-10-07 16:56:08 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-10-09 12:12:28 +0900 |
commit | 7e0ae1698d4db0baec858a46de8d1ae875360cf5 (patch) | |
tree | 646fbe720b13469679973060b8ab5299cf076236 /vm_backtrace.c | |
parent | a220410be70264a0e4089c4d63a9c22dd688ca7c (diff) | |
download | bundler-7e0ae1698d4db0baec858a46de8d1ae875360cf5.tar.gz |
avoid overflow in integer multiplication
This changeset basically replaces `ruby_xmalloc(x * y)` into
`ruby_xmalloc2(x, y)`. Some convenient functions are also
provided for instance `rb_xmalloc_mul_add(x, y, z)` which allocates
x * y + z byes.
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r-- | vm_backtrace.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c index 44a4ac0784..b04f6dac31 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -526,7 +526,7 @@ bt_init(void *ptr, size_t size) struct bt_iter_arg *arg = (struct bt_iter_arg *)ptr; arg->btobj = backtrace_alloc(rb_cBacktrace); GetCoreDataFromValue(arg->btobj, rb_backtrace_t, arg->bt); - arg->bt->backtrace_base = arg->bt->backtrace = ruby_xmalloc(sizeof(rb_backtrace_location_t) * size); + arg->bt->backtrace_base = arg->bt->backtrace = ALLOC_N(rb_backtrace_location_t, size); arg->bt->backtrace_size = 0; } |