[MacRuby] #1098: assert that all memory allocations actually succeeded
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- There are lots of malloc/realloc calls in MacRuby core, but only a few of them actually check that the operation was a success. We need to add assertions everywhere to make sure a memory crasher will be more quickly identified. -- Ticket URL: <http://www.macruby.org/trac/ticket/1098> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by pthomson@…): Doesn't the check for NULL in ruby_xmalloc_memory do this already? -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:1> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by lsansonetti@…): I'm not concerned by auto zone allocations, but by regular ones. -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:2> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by pthomson@…): We could do something clever like loading in a custom malloc() using LD_PRELOAD. -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:3> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by lsansonetti@…): That's not clever but terribly bad, let's just fix the call sites :) -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:4> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by scanfield@…): I'm happy to fix this, but looking at the code I wasn't sure -- should I replace all malloc calls with calls to xmalloc? Or just add individual asserts? xmalloc makes more sense to me but I don't know the local style. -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:5> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by lsansonetti@…): No, malloc calls should not be replaced by xmalloc, because xmalloc returns "collectable" memory (from the libauto malloc zone). What we need here is to simply add assert() calls after each malloc() call, to make sure it does not return a NULL pointer. -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:6> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by lsansonetti@…): Similarly, calloc and realloc calls should also be secured. -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:7> MacRuby <http://macruby.org/>
#1098: assert that all memory allocations actually succeeded -----------------------------------+---------------------------------------- Reporter: lsansonetti@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | -----------------------------------+---------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: MacRuby 1.0 => MacRuby 0.11 Comment: Should be fixed by https://github.com/MacRuby/MacRuby/compare/6b5357a...07bb9e2 -- Ticket URL: <http://www.macruby.org/trac/ticket/1098#comment:8> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby