[Webkit-unassigned] [Bug 96272] NPN_InitializeVariantWithStringCopy is wrong for platforms that return NULL from malloc(0)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 17 09:35:39 PST 2013


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





--- Comment #8 from Darin Adler <darin at apple.com>  2013-01-17 09:37:26 PST ---
(In reply to comment #7)
> But I see that even fastMalloc can return 0 when USE_SYSTEM_MALLOC define is set in Source/WTF/wtf/Platform.h.

That is incorrect.

Here is the code from FastMalloc.cpp (I removed the WTF_MALLOC_VALIDATION #if for clarity):

    void* fastMalloc(size_t n) 
    {
        ASSERT(!isForbidden());
        void* result = malloc(n);
        if (!result)
            CRASH();
        return result;
    }

The function will crash if malloc returns zero. So this implementation is not compatible with systems where the system malloc can return 0 when the passed-in size is 0. If someone needs to use USE_SYSTEM_MALLOC on a system like that, they’ll need to fix that in FastMalloc.cpp; it’s not something we have to worry about elsewhere.

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