From d2b548de6088ec28ceb3c2d10c11f78035c0038d Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 22 Sep 2020 10:53:52 +0900 Subject: Remove the length of `Float' pool from the binary dump. Also fixed the size calculation of `irep` dump, that could cause memory corruption. --- src/dump.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/dump.c') diff --git a/src/dump.c b/src/dump.c index a75b0a88e..0c5ded2e2 100644 --- a/src/dump.c +++ b/src/dump.c @@ -191,10 +191,8 @@ write_pool_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf) cur += uint8_to_bin(IREP_TT_FLOAT, cur); /* data type */ #ifndef MRB_NO_FLOAT { - len = sizeof(double); - cur += uint16_to_bin((uint16_t)len, cur); /* data length */ dump_float(mrb, cur,irep->pool[pool_no].u.f); - cur += len; + cur += sizeof(double); } #else cur += uint16_to_bin(0, cur); /* zero length */ -- cgit v1.2.3