Changeset 226248 in webkit


Ignore:
Timestamp:
Dec 21, 2017 3:57:56 PM (6 years ago)
Author:
Brent Fulgham
Message:

Unreviewed test fix after r226224.
<rdar://problem/36185975>

Pasteboard data is more than a dictionary. We have to whitelist NSString
and NSArray as well. Change method name to reflect that we take a whitelist
of classes that are allowed to be unarchived in the call.
Source/WebCore:

  • platform/ios/PlatformPasteboardIOS.mm:

(WebCore::PlatformPasteboard::write): Use revised method.
(WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.

Source/WebCore/PAL:


  • pal/spi/cocoa/NSKeyedArchiverSPI.h:

(unarchivedObjectOfClassesFromData):
(unarchivedObjectOfClassFromData): Deleted.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r226246 r226248  
     12017-12-21  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Unreviewed test fix after r226224.
     4        <rdar://problem/36185975>
     5
     6        Pasteboard data is more than a dictionary. We have to whitelist NSString
     7        and NSArray as well. Change method name to reflect that we take a whitelist
     8        of classes that are allowed to be unarchived in the call.
     9
     10        * platform/ios/PlatformPasteboardIOS.mm:
     11        (WebCore::PlatformPasteboard::write): Use revised method.
     12        (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
     13
    1142017-12-21  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Source/WebCore/PAL/ChangeLog

    r226239 r226248  
     12017-12-21  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Unreviewed test fix after r226224.
     4        <rdar://problem/36185975>
     5
     6        Pasteboard data is more than a dictionary. We have to whitelist NSString
     7        and NSArray as well. Change method name to reflect that we take a whitelist
     8        of classes that are allowed to be unarchived in the call.
     9       
     10        * pal/spi/cocoa/NSKeyedArchiverSPI.h:
     11        (unarchivedObjectOfClassesFromData):
     12        (unarchivedObjectOfClassFromData): Deleted.
     13
    1142017-12-21  Jeremy Jones  <jeremyj@apple.com>
    215
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h

    r226224 r226248  
    9393}
    9494
    95 inline id _Nullable unarchivedObjectOfClassFromData(Class _Nonnull cls, NSData * _Nonnull data)
     95inline id _Nullable unarchivedObjectOfClassesFromData(NSSet<Class> * _Nonnull classes, NSData * _Nonnull data)
    9696{
    9797#if USE(SECURE_ARCHIVER_API)
    9898#if !USE(SECURE_ARCHIVER_FOR_ATTRIBUTED_STRING)
    9999    // Remove this code when the fix from <rdar://problem/31376830> is deployed to all relevant build targets.
    100     if (cls == [NSAttributedString class])
     100    if ([classes containsObject:[NSAttributedString class]])
    101101        return insecurelyUnarchiveObjectFromData(data);
    102102#endif
    103103    NSError *error;
    104     id value = [NSKeyedUnarchiver unarchivedObjectOfClass:cls fromData:data error:&error];
     104    id value = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:data error:&error];
    105105    if (!value)
    106106        LOG_ERROR("Unable to unarchive data: %@", error);
    107107    return value;
    108108#else
    109     UNUSED_PARAM(cls);
     109    UNUSED_PARAM(classes);
    110110    return insecurelyUnarchiveObjectFromData(data);
    111111#endif
  • trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm

    r226224 r226248  
    266266
    267267    if (content.dataInAttributedStringFormat) {
    268         NSAttributedString *attributedString = unarchivedObjectOfClassFromData([NSAttributedString class], content.dataInAttributedStringFormat->createNSData().get());
     268        NSAttributedString *attributedString = unarchivedObjectOfClassesFromData([NSSet setWithObject:[NSAttributedString class]], content.dataInAttributedStringFormat->createNSData().get());
    269269        if (attributedString)
    270270            [representationsToRegister addRepresentingObject:attributedString];
     
    381381            continue;
    382382
    383         NSDictionary *teamDataObject = unarchivedObjectOfClassFromData([NSDictionary class], provider.teamData);
     383        NSDictionary *teamDataObject = unarchivedObjectOfClassesFromData([NSSet setWithObjects:[NSDictionary class], [NSString class], [NSArray class], nil], provider.teamData);
    384384        if (!teamDataObject)
    385385            continue;
Note: See TracChangeset for help on using the changeset viewer.