[MacRuby] #1025: Sandbox#apply! causes segfault when no argument is passed to constructor.

MacRuby ruby-noreply at macosforge.org
Tue Jan 4 06:27:38 PST 2011


#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/>



More information about the macruby-tickets mailing list