Ignore:
Timestamp:
Apr 19, 2009, 3:54:39 PM (16 years ago)
Author:
[email protected]
Message:

2009-04-19 Sam Weinig <[email protected]>

Reviewed by Darin Adler.

Better fix for JSStringCreateWithCFString hardening.

  • API/JSStringRefCF.cpp: (JSStringCreateWithCFString):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSStringRefCF.cpp

    r42659 r42662  
    3838{
    3939    JSC::initializeThreading();
    40     CFIndex length = CFStringGetLength(string);
    41     if (length < 0)
    42         CRASH():
     40
     41    // We cannot use CFIndex here since CFStringGetLength can return values larger than
     42    // it can hold.  (<rdar://problem/6806478>)
     43    size_t length = CFStringGetLength(string);
    4344    if (length) {
    4445        OwnArrayPtr<UniChar> buffer(new UniChar[length]);
Note: See TracChangeset for help on using the changeset viewer.