mruby · GitHub

Commit 550d10a

committed

Fixed heap buffer overflow in #method_missing

When `ci->n == CALL_MAXARGS`, the correct value is `argv[1] = argv[1]`. However, it was always `args[1] = args[ci->n]`, which caused objects outside the range to be picked up. fixed #6584

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • src

Lines changed: 3 additions & 1 deletion

Original file line numberDiff line numberDiff line change

@@ -697,7 +697,9 @@ prepare_missing(mrb_state *mrb, mrb_callinfo *ci, mrb_value recv, mrb_sym mid, m

697697

}

698698

else {

699699

mrb_assert(ci->nk == 15);

700-

argv[1] = argv[ci->n];

700+

if (ci->n != CALL_MAXARGS) {

701+

argv[1] = argv[ci->n]; /* keyword arguments */

702+

}

701703

argv[2] = blk;

702704

}

703705

argv[0] = args; /* must be replaced after saving argv[0] as it may be a keyword argument */

0 commit comments

Comments

 (0)

Read the original on github.com ↗