Changeset 238553 in webkit
- Timestamp:
- Nov 27, 2018 7:51:43 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r238552 r238553 1 2018-11-27 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 WebKit.AddAndRemoveDataDetectors hits a debug assertion after r238515 4 https://bugs.webkit.org/show_bug.cgi?id=191996 5 6 Reviewed by Tim Horton. 7 8 This assertion is hit because `decode(Decoder& decoder, NSArray<Class> *allowedClasses)` expects the decoded 9 object (of class `_NSArrayM`) to be equal to `NSArray.class`. 10 11 We fix the crash by relaxing the debug assertion when decoding securely-codable objects over IPC. Instead of 12 checking that the class of the decoded object is equal to one of the allowed classes, check that the object is a 13 kind of any of the allowed classes. 14 15 * Shared/Cocoa/ArgumentCodersCocoa.h: 16 (IPC::isObjectClassAllowed): 17 (IPC::decode): 18 1 19 2018-11-27 Tomas Popela <tpopela@redhat.com> 2 20 -
trunk/Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.h
r238515 r238553 44 44 } 45 45 46 #ifndef NDEBUG 47 48 static inline bool isObjectClassAllowed(id object, NSArray<Class> *allowedClasses) 49 { 50 for (Class allowedClass in allowedClasses) { 51 if ([object isKindOfClass:allowedClass]) 52 return true; 53 } 54 return false; 55 } 56 57 #endif 58 46 59 template<typename T> 47 60 std::optional<RetainPtr<T>> decode(Decoder& decoder, NSArray<Class> *allowedClasses) … … 55 68 56 69 id object = result->leakRef(); 57 ASSERT( [allowedClasses containsObject:[object class]]);70 ASSERT(isObjectClassAllowed(object, allowedClasses)); 58 71 return { adoptNS(static_cast<T *>(object)) }; 59 72 }
Note: See TracChangeset
for help on using the changeset viewer.