mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Backtrace list must be an array of strings; fix #3408
This commit is contained in:
+13
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user