mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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)`.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user