mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix heap buffer overflow when dump irep
Currently, the size of writing in heap by write_irep_record() is bigger than The size that is calculated by get_irep_record_size. Therefore, irep is dumped over the size of allocating memory when we execute dump_irep().
This commit is contained in:
@@ -293,6 +293,7 @@ get_irep_record_size_1(mrb_state *mrb, const mrb_irep *irep)
|
||||
size_t size = 0;
|
||||
|
||||
size += get_irep_header_size(mrb);
|
||||
size += sizeof(uint16_t);
|
||||
size += get_iseq_block_size(mrb, irep);
|
||||
size += get_catch_table_block_size(mrb, irep);
|
||||
size += get_pool_block_size(mrb, irep);
|
||||
|
||||
Reference in New Issue
Block a user