[Webkit-unassigned] [Bug 34569] New: Don't call CRASH() in fastMalloc, fastCalloc and fastRealloc when the requested memory size is 0

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 4 03:15:22 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=34569

           Summary: Don't call CRASH() in fastMalloc, fastCalloc and
                    fastRealloc when the requested memory size is 0
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: kwangyul.seo at gmail.com


With USE_SYSTEM_MALLOC=1, fastMalloc, fastCalloc and fastRealloc call CRASH()
if the return value of malloc, calloc and realloc is 0. However, those
functions can return 0 when the request size is 0.

>From the libc manual of malloc,

"If size is 0, then malloc() returns either NULL, or a unique pointer value
that can later be successfully passed to free()."

Though it seems malloc returns a unique pointer in most systems, 0 can be
returned in some systems. For instance, BREW's MALLOC returns 0 when size is 0.

Add a check if the request size is 0 or not before calling CRASH(). As the
condition is short-circuited, it adds no runtime overhead in usual allocation
scenario.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list