#1025: Sandbox#apply! causes segfault when no argument is passed to constructor. -----------------------------+---------------------------------------------- Reporter: rob@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------+---------------------------------------------- Comment(by watson1978@…): I attach a patch. please check it :) {{{ #!diff diff --git a/sandbox.c b/sandbox.c index 9cfc172..3faff18 100644 --- a/sandbox.c +++ b/sandbox.c @@ -86,6 +86,9 @@ rb_sandbox_apply(VALUE self, SEL sel) rb_sandbox_t *box; Data_Get_Struct(self, rb_sandbox_t, box); char *error = NULL; + if (box->profile == NULL || box->flags == 0) { + rb_raise(rb_eRuntimeError, "needs a profile."); + } if (sandbox_init(box->profile, box->flags, &error) == -1) { rb_raise(rb_eSecurityError, "Couldn't apply sandbox: `%s`", error); } }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1025#comment:2> MacRuby <http://macruby.org/>