Skip to content
Permalink
Browse files
Backtrace list must be an array of strings; fix #3408
  • Loading branch information
matz committed Jan 23, 2017
1 parent 28b7b9e commit 324887d0d61ce2127dfd839930a88507c1641b75
Showing 1 changed file with 13 additions and 0 deletions.
@@ -208,6 +208,19 @@ exc_set_backtrace(mrb_state *mrb, mrb_value exc)
mrb_value backtrace;

mrb_get_args(mrb, "o", &backtrace);
if (!mrb_array_p(backtrace)) {
type_err:
mrb_raise(mrb, E_TYPE_ERROR, "backtrace must be Array of String");
}
else {
const mrb_value *p = RARRAY_PTR(backtrace);
const mrb_value *pend = p + RARRAY_LEN(backtrace);

while (p < pend) {
if (!mrb_string_p(*p)) goto type_err;
p++;
}
}
mrb_iv_set(mrb, exc, mrb_intern_lit(mrb, "backtrace"), backtrace);

return backtrace;

0 comments on commit 324887d

Please sign in to comment.