Changeset 259789 in webkit
- Timestamp:
- Apr 9, 2020, 4:01:58 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Shared/UserData.cpp (modified) (3 diffs)
-
Shared/UserData.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r259788 r259789 1 2020-04-09 David Kilzer <ddkilzer@apple.com> 2 3 UserData::decode should add bounds checks 4 <https://webkit.org/b/210247> 5 <rdar://problem/61467748> 6 7 Reviewed by Alex Christensen. 8 9 * Shared/UserData.cpp: 10 (WebKit::UserData::decode): 11 - Add bounds checks using WTF::isInBounds<size_t>. 12 * Shared/UserData.h: 13 (WebKit::UserData::decode): 14 - Add WARN_UNUSED_RETURN. 15 1 16 2020-04-09 David Kilzer <ddkilzer@apple.com> 2 17 -
trunk/Source/WebKit/Shared/UserData.cpp
r251436 r259789 50 50 #include "WebRenderLayer.h" 51 51 #include "WebRenderObject.h" 52 #include <wtf/CheckedArithmetic.h> 52 53 53 54 #if PLATFORM(COCOA) … … 341 342 switch (type) { 342 343 case API::Object::Type::Array: { 343 uint64_t size; 344 if (!decoder.decode(size)) 345 return false; 344 uint64_t decodedSize; 345 if (!decoder.decode(decodedSize)) 346 return false; 347 348 if (!WTF::isInBounds<size_t>(decodedSize)) 349 return false; 350 351 auto size = static_cast<size_t>(decodedSize); 346 352 347 353 Vector<RefPtr<API::Object>> elements; … … 377 383 378 384 case API::Object::Type::Dictionary: { 379 uint64_t size; 380 if (!decoder.decode(size)) 381 return false; 385 uint64_t decodedSize; 386 if (!decoder.decode(decodedSize)) 387 return false; 388 389 if (!WTF::isInBounds<size_t>(decodedSize)) 390 return false; 391 392 auto size = static_cast<size_t>(decodedSize); 382 393 383 394 API::Dictionary::MapType map; -
trunk/Source/WebKit/Shared/UserData.h
r204668 r259789 53 53 54 54 void encode(IPC::Encoder&) const; 55 static bool decode(IPC::Decoder&, UserData&) ;55 static bool decode(IPC::Decoder&, UserData&) WARN_UNUSED_RETURN; 56 56 57 57 static void encode(IPC::Encoder&, const API::Object*); 58 static bool decode(IPC::Decoder&, RefPtr<API::Object>&) ;58 static bool decode(IPC::Decoder&, RefPtr<API::Object>&) WARN_UNUSED_RETURN; 59 59 60 60 private:
Note:
See TracChangeset
for help on using the changeset viewer.