summaryrefslogtreecommitdiffhomepage
path: root/src/dump.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-09-22 10:53:52 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 18:20:28 +0900
commitd2b548de6088ec28ceb3c2d10c11f78035c0038d (patch)
tree2bd352af85e3ca1fb05546cd72f271de76be0cde /src/dump.c
parentc80ece214967d8d948ac31ab5474c973fed52708 (diff)
downloadmruby-d2b548de6088ec28ceb3c2d10c11f78035c0038d.tar.gz
mruby-d2b548de6088ec28ceb3c2d10c11f78035c0038d.zip
Remove the length of `Float' pool from the binary dump.
Also fixed the size calculation of `irep` dump, that could cause memory corruption.
Diffstat (limited to 'src/dump.c')
-rw-r--r--src/dump.c4
1 files changed, 1 insertions, 3 deletions
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 */