mruby · GitHub

Commit b3b8c01

matzclaude

and

committed

load.c: fix off-by-one in bounds check for symbol names

Same issue as the pool string fix: the bounds check for symbol names only validated snl bytes, but the binary format includes a null terminator. The source pointer advances by snl+1, so the check must account for it. Co-authored-by: Claude <noreply@anthropic.com>

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • src

Lines changed: 1 addition & 1 deletion

Original file line numberDiff line numberDiff line change

@@ -231,7 +231,7 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, const uint8_t *end, size_

231231

continue;

232232

}

233233
234-

if (src + snl > end) return FALSE;

234+

if (src + snl + 1 > end) return FALSE;

235235

if (flags & FLAG_SRC_MALLOC) {

236236

syms[i] = mrb_intern(mrb, (char*)src, snl);

237237

}

0 commit comments

Comments

 (0)

Read the original on github.com ↗