Commit 0fdf5d9b authored by dearblue's avatar dearblue

Fix NULL pointer dereference with mruby-os-memsize and mruby-method

If it gets an insubstantial method object with `obj.method`, it will raise a `SIGSEGV` with `ObjectSpace.memsize_of(method)`.
parent 0aa8db9a
......@@ -33,6 +33,7 @@ os_memsize_of_method(mrb_state* mrb, mrb_value method_obj)
size_t size;
mrb_value proc_value = mrb_obj_iv_get(mrb, mrb_obj_ptr(method_obj),
mrb_intern_lit(mrb, "_proc"));
if (mrb_nil_p(proc_value)) return 0;
struct RProc *proc = mrb_proc_ptr(proc_value);
size = sizeof(struct RProc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment