diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-06-04 13:49:16 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-06-04 15:31:40 +0900 |
commit | 7ddc5e6187fdf531fe5e92f01bb4624c06bddda2 (patch) | |
tree | b1754eeb401894c78e3edeee7fb692597e783d3d /compile.c | |
parent | c5f7d274d78a5ef6818bc5d344a1f27bf2f794c4 (diff) |
Suppress overflow warning at `ALLOC_N` in `iseq_set_local_table`
`xmalloc2` checks the overflow of arguments multiplication.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13509
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 5 |
1 files changed, 4 insertions, 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; } |