mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Suppress overflow warning at ALLOC_N
in iseq_set_local_table
`xmalloc2` checks the overflow of arguments multiplication.
This commit is contained in:
parent
c5f7d274d7
commit
7ddc5e6187
Notes:
git
2025-06-04 07:38:10 +00:00
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue