Skip to content

Commit 63f6f87

Browse files
committed
Add underflow check
1 parent dc74f9c commit 63f6f87

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compile.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,15 +2178,13 @@ iseq_set_local_table(rb_iseq_t *iseq, const rb_ast_id_table_t *tbl, const NODE *
21782178
// then its local table should only be `...`
21792179
// FIXME: I think this should be fixed in the AST rather than special case here.
21802180
if (args->forwarding && args->pre_args_num == 0 && !args->opt_args) {
2181+
CHECK(size >= 3);
21812182
size -= 3;
21822183
offset += 3;
21832184
}
21842185
}
21852186

21862187
if (size > 0) {
2187-
#if SIZEOF_INT >= SIZEOF_SIZE_T
2188-
ASSUME(size < SIZE_MAX / sizeof(ID)); /* checked in xmalloc2_size */
2189-
#endif
21902188
ID *ids = ALLOC_N(ID, size);
21912189
MEMCPY(ids, tbl->ids + offset, ID, size);
21922190
ISEQ_BODY(iseq)->local_table = ids;

0 commit comments

Comments
 (0)