mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 20:19:19 +00:00
Add underflow check
This commit is contained in:
parent
dc74f9cb36
commit
63f6f87e86
@ -2178,15 +2178,13 @@ iseq_set_local_table(rb_iseq_t *iseq, const rb_ast_id_table_t *tbl, const NODE *
|
||||
// then its local table should only be `...`
|
||||
// FIXME: I think this should be fixed in the AST rather than special case here.
|
||||
if (args->forwarding && args->pre_args_num == 0 && !args->opt_args) {
|
||||
CHECK(size >= 3);
|
||||
size -= 3;
|
||||
offset += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (size > 0) {
|
||||
#if SIZEOF_INT >= SIZEOF_SIZE_T
|
||||
ASSUME(size < SIZE_MAX / sizeof(ID)); /* checked in xmalloc2_size */
|
||||
#endif
|
||||
ID *ids = ALLOC_N(ID, size);
|
||||
MEMCPY(ids, tbl->ids + offset, ID, size);
|
||||
ISEQ_BODY(iseq)->local_table = ids;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user