Title: [226248] trunk/Source/WebCore
Revision
226248
Author
[email protected]
Date
2017-12-21 15:57:56 -0800 (Thu, 21 Dec 2017)

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226247 => 226248)


--- trunk/Source/WebCore/ChangeLog	2017-12-21 23:05:11 UTC (rev 226247)
+++ trunk/Source/WebCore/ChangeLog	2017-12-21 23:57:56 UTC (rev 226248)
@@ -1,3 +1,16 @@
+2017-12-21  Brent Fulgham  <[email protected]>
+
+        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.
+
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::PlatformPasteboard::write): Use revised method.
+        (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
+
 2017-12-21  Zalan Bujtas  <[email protected]>
 
         [RenderTreeBuilder] Move RenderRubyAsInline::addChild mutation to a RenderTreeBuilder

Modified: trunk/Source/WebCore/PAL/ChangeLog (226247 => 226248)


--- trunk/Source/WebCore/PAL/ChangeLog	2017-12-21 23:05:11 UTC (rev 226247)
+++ trunk/Source/WebCore/PAL/ChangeLog	2017-12-21 23:57:56 UTC (rev 226248)
@@ -1,3 +1,16 @@
+2017-12-21  Brent Fulgham  <[email protected]>
+
+        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.
+        
+        * pal/spi/cocoa/NSKeyedArchiverSPI.h:
+        (unarchivedObjectOfClassesFromData):
+        (unarchivedObjectOfClassFromData): Deleted.
+
 2017-12-21  Jeremy Jones  <[email protected]>
 
         Update FULLSCREEN_API feature defines.

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h (226247 => 226248)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h	2017-12-21 23:05:11 UTC (rev 226247)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h	2017-12-21 23:57:56 UTC (rev 226248)
@@ -92,21 +92,21 @@
 #pragma clang diagnostic pop
 }
 
-inline id _Nullable unarchivedObjectOfClassFromData(Class _Nonnull cls, NSData * _Nonnull data)
+inline id _Nullable unarchivedObjectOfClassesFromData(NSSet<Class> * _Nonnull classes, NSData * _Nonnull data)
 {
 #if USE(SECURE_ARCHIVER_API)
 #if !USE(SECURE_ARCHIVER_FOR_ATTRIBUTED_STRING)
     // Remove this code when the fix from <rdar://problem/31376830> is deployed to all relevant build targets.
-    if (cls == [NSAttributedString class])
+    if ([classes containsObject:[NSAttributedString class]])
         return insecurelyUnarchiveObjectFromData(data);
 #endif
     NSError *error;
-    id value = [NSKeyedUnarchiver unarchivedObjectOfClass:cls fromData:data error:&error];
+    id value = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:data error:&error];
     if (!value)
         LOG_ERROR("Unable to unarchive data: %@", error);
     return value;
 #else
-    UNUSED_PARAM(cls);
+    UNUSED_PARAM(classes);
     return insecurelyUnarchiveObjectFromData(data);
 #endif
 }

Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (226247 => 226248)


--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2017-12-21 23:05:11 UTC (rev 226247)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2017-12-21 23:57:56 UTC (rev 226248)
@@ -265,7 +265,7 @@
         [representationsToRegister addData:content.dataInWebArchiveFormat->createNSData().get() forType:WebArchivePboardType];
 
     if (content.dataInAttributedStringFormat) {
-        NSAttributedString *attributedString = unarchivedObjectOfClassFromData([NSAttributedString class], content.dataInAttributedStringFormat->createNSData().get());
+        NSAttributedString *attributedString = unarchivedObjectOfClassesFromData([NSSet setWithObject:[NSAttributedString class]], content.dataInAttributedStringFormat->createNSData().get());
         if (attributedString)
             [representationsToRegister addRepresentingObject:attributedString];
     }
@@ -380,7 +380,7 @@
         if (!provider.teamData.length)
             continue;
 
-        NSDictionary *teamDataObject = unarchivedObjectOfClassFromData([NSDictionary class], provider.teamData);
+        NSDictionary *teamDataObject = unarchivedObjectOfClassesFromData([NSSet setWithObjects:[NSDictionary class], [NSString class], [NSArray class], nil], provider.teamData);
         if (!teamDataObject)
             continue;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to