Changeset 140751 in webkit


Ignore:
Timestamp:
Jan 24, 2013 4:56:19 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

NPN_InitializeVariantWithStringCopy is wrong for platforms returning NULL from malloc(0)
https://bugs.webkit.org/show_bug.cgi?id=96272

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-01-24
Reviewed by Alexey Proskuryakov.

No new tests. This is platform dependent.

  • bridge/npruntime.cpp:

(NPN_InitializeVariantWithStringCopy):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140749 r140751  
     12013-01-24  Julien Brianceau  <jbrianceau@nds.com>
     2
     3        NPN_InitializeVariantWithStringCopy is wrong for platforms returning NULL from malloc(0)
     4        https://bugs.webkit.org/show_bug.cgi?id=96272
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        No new tests. This is platform dependent.
     9
     10        * bridge/npruntime.cpp:
     11        (NPN_InitializeVariantWithStringCopy):
     12
    1132013-01-24  Christian Biesinger  <cbiesinger@chromium.org>
    214
  • trunk/Source/WebCore/bridge/npruntime.cpp

    r40415 r140751  
    8686    variant->type = NPVariantType_String;
    8787    variant->value.stringValue.UTF8Length = value->UTF8Length;
    88     variant->value.stringValue.UTF8Characters = (NPUTF8 *)malloc(sizeof(NPUTF8) * value->UTF8Length);
    89     if (!variant->value.stringValue.UTF8Characters)
     88    // Switching to fastMalloc would be better to avoid length check but this is not desirable
     89    // as NPN_MemAlloc is using malloc and there might be plugins that mix NPN_MemAlloc and malloc too.
     90    variant->value.stringValue.UTF8Characters = (NPUTF8*)malloc(sizeof(NPUTF8) * value->UTF8Length);
     91    if (value->UTF8Length && !variant->value.stringValue.UTF8Characters)
    9092        CRASH();
    9193    memcpy((void*)variant->value.stringValue.UTF8Characters, value->UTF8Characters, sizeof(NPUTF8) * value->UTF8Length);
Note: See TracChangeset for help on using the changeset viewer.