Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed wrong section size calculation #1100

Merged
merged 1 commit into from

2 participants

@masuidrive

No description provided.

@matz matz merged commit 5fb12a9 into mruby:master
@masuidrive masuidrive deleted the masuidrive:fixed_debug_args branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 28, 2013
  1. @masuidrive
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/load.c
View
10 src/load.c
@@ -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;
Something went wrong with that request. Please try again.