Commit 1e58b9c2 authored by Yuichiro MASUI's avatar Yuichiro MASUI

Fixed wrong section size calculation

parent d5021172
......@@ -234,9 +234,12 @@ read_rite_lineno_record(mrb_state *mrb, const uint8_t *bin, size_t irepno, uint3
short *lines;
ret = MRB_DUMP_OK;
*len = 0;
bin += sizeof(uint32_t); // record size
*len += sizeof(uint32_t);
fname_len = bin_to_uint16(bin);
bin += sizeof(uint16_t);
*len += sizeof(uint16_t);
fname = (char *)mrb_malloc(mrb, fname_len + 1);
if (fname == NULL) {
ret = MRB_DUMP_GENERAL_FAILURE;
......@@ -245,15 +248,18 @@ read_rite_lineno_record(mrb_state *mrb, const uint8_t *bin, size_t irepno, uint3
memcpy(fname, bin, fname_len);
fname[fname_len] = '\0';
bin += fname_len;
*len += fname_len;
niseq = bin_to_uint32(bin);
bin += sizeof(uint32_t); // niseq
*len += sizeof(uint32_t);
lines = (short *)mrb_malloc(mrb, niseq * sizeof(short));
for (i = 0; i < niseq; i++) {
lines[i] = bin_to_uint16(bin);
bin += sizeof(short); // niseq
}
bin += sizeof(uint16_t); // niseq
*len += sizeof(uint16_t);
}
mrb->irep[irepno]->filename = fname;
mrb->irep[irepno]->lines = lines;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment