⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249087 in webkit


Ignore:
Timestamp:
Aug 24, 2019, 9:02:52 AM (7 years ago)
Author:
Chris Dumez
Message:

Make CacheStorageEngineCaches's decodeCachesNames() more robust against bad input data
https://bugs.webkit.org/show_bug.cgi?id=201102

Reviewed by Antti Koivisto.

Use Vector::tryReserveCapacity() instead of Vector::reserveInitialCapacity() in CacheStorage::decodeCachesNames()
since the size is read from disk and thus cannot be trusted. If the size is too large, reserveInitialCapacity()
would end up crashing the network process. Now, we merely discard the data if tryReserveCapacity() fails because
the size is too large.

  • NetworkProcess/cache/CacheStorageEngineCaches.cpp:

(WebKit::CacheStorage::decodeCachesNames):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r249074 r249087  
     12019-08-24  Chris Dumez  <cdumez@apple.com>
     2
     3        Make CacheStorageEngineCaches's decodeCachesNames() more robust against bad input data
     4        https://bugs.webkit.org/show_bug.cgi?id=201102
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Use Vector::tryReserveCapacity() instead of Vector::reserveInitialCapacity() in CacheStorage::decodeCachesNames()
     9        since the size is read from disk and thus cannot be trusted. If the size is too large, reserveInitialCapacity()
     10        would end up crashing the network process. Now, we merely discard the data if tryReserveCapacity() fails because
     11        the size is too large.
     12
     13        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
     14        (WebKit::CacheStorage::decodeCachesNames):
     15
    1162019-08-23  Wenson Hsieh  <wenson_hsieh@apple.com>
    217
  • trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp

    r245715 r249087  
    412412
    413413    Vector<std::pair<String, String>> names;
    414     names.reserveInitialCapacity(count);
     414    if (!names.tryReserveCapacity(count))
     415        return makeUnexpected(Error::ReadDisk);
     416
    415417    for (size_t index = 0; index < count; ++index) {
    416418        String name;
Note: See TracChangeset for help on using the changeset viewer.