dump.c: fix a bug in dump data size of BIGINT pool.
Was dumping extra NUL (\0) after the data.
MODIFY
src/dump.c
src/dump.c
@@ -131,7 +131,6 @@ get_pool_block_size(mrb_state *mrb, const mrb_irep *irep)
{
mrb_int len = irep->pool[pool_no].u.str[0];
mrb_assert_int_fit(mrb_int, len, size_t, SIZE_MAX);
- size += sizeof(uint8_t);
size += (size_t)len+2;
}
break;
@@ -199,7 +198,6 @@ write_pool_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf)
len = irep->pool[pool_no].u.str[0];
memcpy(cur, irep->pool[pool_no].u.str, (size_t)len+2);
cur += len+2;
- *cur++ = '\0';
break;
case IREP_TT_FLOAT:

MODIFY
src/load.c
src/load.c
@@ -163,16 +163,16 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, const uint8_t *end, size_
#endif
case IREP_TT_BIGINT:
- pool_data_len = bin_to_uint8(src); /* pool data length */
+ pool_data_len = bin_to_uint8(src) + 2; /* pool data length */
if (src + pool_data_len > end) return FALSE;
- {
+ else {
char *p;
pool[i].tt = IREP_TT_BIGINT;
- p = (char*)mrb_malloc(mrb, pool_data_len+2);
- memcpy(p, src, pool_data_len+2);
+ p = (char*)mrb_malloc(mrb, pool_data_len);
+ memcpy(p, src, pool_data_len);
pool[i].u.str = (const char*)p;
}
- src += pool_data_len + 2;
+ src += pool_data_len;
break;
case IREP_TT_FLOAT:

dump.c: fix a bug in dump data size of BIGINT pool.

Was dumping extra NUL (\0) after the data.