Suppress overflow warning at ALLOC_N in iseq_set_local_table

`xmalloc2` checks the overflow of arguments multiplication.
This commit is contained in:
Nobuyoshi Nakada 2025-06-04 13:49:16 +09:00
parent c5f7d274d7
commit 7ddc5e6187
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-06-04 07:38:10 +00:00

View File

@ -2184,7 +2184,10 @@ iseq_set_local_table(rb_iseq_t *iseq, const rb_ast_id_table_t *tbl, const NODE *
}
if (size > 0) {
ID *ids = (ID *)ALLOC_N(ID, size);
#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;
}