Changeset 259814 in webkit
- Timestamp:
- Apr 9, 2020, 12:33:20 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/persistence/PersistentCoders.cpp (modified) (1 diff)
-
WTF/wtf/persistence/PersistentCoders.h (modified) (11 diffs)
-
WTF/wtf/persistence/PersistentDecoder.h (modified) (4 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r259788 r259814 1 2020-04-09 David Kilzer <ddkilzer@apple.com> 2 3 WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN 4 <https://webkit.org/b/210238> 5 <rdar://problem/61491575> 6 7 Reviewed by Darin Adler. 8 9 * wtf/persistence/PersistentCoders.cpp: 10 (WTF::Persistence::decodeStringText): 11 - Add WARN_UNUSED_RETURN. 12 13 * wtf/persistence/PersistentCoders.h: 14 (WTF::Persistence::Coder<Optional<T>>::decode): 15 (WTF::Persistence::Coder<Seconds>::decode): 16 (WTF::Persistence::Coder<WallTime>::decode): 17 - Add WARN_UNUSED_RETURN. 18 - Add missing return value check for 19 decode.decodeFixedLengthData(). 20 21 * wtf/persistence/PersistentDecoder.h: 22 (WTF::Persistence::Decoder::decode): 23 (WTF::Persistence::Decoder::decodeEnum): 24 (WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const): 25 - Add WARN_UNUSED_RETURN. 26 1 27 2020-04-09 David Kilzer <ddkilzer@apple.com> 2 28 -
trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp
r246490 r259814 107 107 108 108 template <typename CharacterType> 109 static inline bool decodeStringText(Decoder& decoder, uint32_t length, String& result)109 static inline WARN_UNUSED_RETURN bool decodeStringText(Decoder& decoder, uint32_t length, String& result) 110 110 { 111 111 // Before allocating the string, make sure that the decoder buffer is big enough. -
trunk/Source/WTF/wtf/persistence/PersistentCoders.h
r259788 r259814 47 47 } 48 48 49 static bool decode(Decoder& decoder, std::pair<T, U>& pair)49 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, std::pair<T, U>& pair) 50 50 { 51 51 T first; … … 75 75 } 76 76 77 static bool decode(Decoder& decoder, Optional<T>& optional)77 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Optional<T>& optional) 78 78 { 79 79 bool isEngaged; … … 101 101 } 102 102 103 static bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)103 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair) 104 104 { 105 105 KeyType key; … … 127 127 } 128 128 129 static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)129 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector) 130 130 { 131 131 uint64_t size; … … 155 155 } 156 156 157 static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)157 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector) 158 158 { 159 159 uint64_t decodedSize; … … 175 175 temp.grow(size); 176 176 177 decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T)); 177 if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T))) 178 return false; 178 179 179 180 vector.swap(temp); … … 194 195 } 195 196 196 static bool decode(Decoder& decoder, HashMapType& hashMap)197 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashMapType& hashMap) 197 198 { 198 199 uint64_t hashMapSize; … … 231 232 } 232 233 233 static bool decode(Decoder& decoder, HashSetType& hashSet)234 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashSetType& hashSet) 234 235 { 235 236 uint64_t hashSetSize; … … 260 261 } 261 262 262 static bool decode(Decoder& decoder, Seconds& result)263 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Seconds& result) 263 264 { 264 265 double value; … … 277 278 } 278 279 279 static bool decode(Decoder& decoder, WallTime& result)280 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WallTime& result) 280 281 { 281 282 double value; … … 290 291 template<> struct Coder<AtomString> { 291 292 WTF_EXPORT_PRIVATE static void encode(Encoder&, const AtomString&); 292 WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomString&) ;293 WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomString&) WARN_UNUSED_RETURN; 293 294 }; 294 295 295 296 template<> struct Coder<CString> { 296 297 WTF_EXPORT_PRIVATE static void encode(Encoder&, const CString&); 297 WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&) ;298 WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&) WARN_UNUSED_RETURN; 298 299 }; 299 300 300 301 template<> struct Coder<String> { 301 302 WTF_EXPORT_PRIVATE static void encode(Encoder&, const String&); 302 WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&) ;303 WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&) WARN_UNUSED_RETURN; 303 304 }; 304 305 305 306 template<> struct Coder<SHA1::Digest> { 306 307 WTF_EXPORT_PRIVATE static void encode(Encoder&, const SHA1::Digest&); 307 WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&) ;308 WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&) WARN_UNUSED_RETURN; 308 309 }; 309 310 -
trunk/Source/WTF/wtf/persistence/PersistentDecoder.h
r255846 r259814 42 42 size_t currentOffset() const { return m_bufferPosition - m_buffer; } 43 43 44 WTF_EXPORT_PRIVATE bool verifyChecksum() ;44 WTF_EXPORT_PRIVATE bool verifyChecksum() WARN_UNUSED_RETURN; 45 45 46 WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t) ;46 WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t) WARN_UNUSED_RETURN; 47 47 48 WTF_EXPORT_PRIVATE bool decode(bool&) ;49 WTF_EXPORT_PRIVATE bool decode(uint8_t&) ;50 WTF_EXPORT_PRIVATE bool decode(uint16_t&) ;51 WTF_EXPORT_PRIVATE bool decode(uint32_t&) ;52 WTF_EXPORT_PRIVATE bool decode(uint64_t&) ;53 WTF_EXPORT_PRIVATE bool decode(int16_t&) ;54 WTF_EXPORT_PRIVATE bool decode(int32_t&) ;55 WTF_EXPORT_PRIVATE bool decode(int64_t&) ;56 WTF_EXPORT_PRIVATE bool decode(float&) ;57 WTF_EXPORT_PRIVATE bool decode(double&) ;48 WTF_EXPORT_PRIVATE bool decode(bool&) WARN_UNUSED_RETURN; 49 WTF_EXPORT_PRIVATE bool decode(uint8_t&) WARN_UNUSED_RETURN; 50 WTF_EXPORT_PRIVATE bool decode(uint16_t&) WARN_UNUSED_RETURN; 51 WTF_EXPORT_PRIVATE bool decode(uint32_t&) WARN_UNUSED_RETURN; 52 WTF_EXPORT_PRIVATE bool decode(uint64_t&) WARN_UNUSED_RETURN; 53 WTF_EXPORT_PRIVATE bool decode(int16_t&) WARN_UNUSED_RETURN; 54 WTF_EXPORT_PRIVATE bool decode(int32_t&) WARN_UNUSED_RETURN; 55 WTF_EXPORT_PRIVATE bool decode(int64_t&) WARN_UNUSED_RETURN; 56 WTF_EXPORT_PRIVATE bool decode(float&) WARN_UNUSED_RETURN; 57 WTF_EXPORT_PRIVATE bool decode(double&) WARN_UNUSED_RETURN; 58 58 59 template<typename E> auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool> 59 template<typename E> WARN_UNUSED_RETURN 60 auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool> 60 61 { 61 62 uint64_t value; … … 69 70 } 70 71 71 template<typename T> bool decodeEnum(T& result) 72 template<typename T> WARN_UNUSED_RETURN 73 bool decodeEnum(T& result) 72 74 { 73 75 static_assert(sizeof(T) <= 8, "Enum type T must not be larger than 64 bits!"); … … 81 83 } 82 84 83 template<typename T> auto decode(T& t) -> std::enable_if_t<!std::is_enum<T>::value, bool> 85 template<typename T> WARN_UNUSED_RETURN 86 auto decode(T& t) -> std::enable_if_t<!std::is_enum<T>::value, bool> 84 87 { 85 88 return Coder<T>::decode(*this, t); 86 89 } 87 90 88 template<typename T> 91 template<typename T> WARN_UNUSED_RETURN 89 92 bool bufferIsLargeEnoughToContain(size_t numElements) const 90 93 { … … 100 103 101 104 private: 102 WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const ;103 template<typename Type> bool decodeNumber(Type&) ;105 WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const WARN_UNUSED_RETURN; 106 template<typename Type> bool decodeNumber(Type&) WARN_UNUSED_RETURN; 104 107 105 108 const uint8_t* m_buffer; -
trunk/Source/WebKit/ChangeLog
r259812 r259814 1 2020-04-09 David Kilzer <ddkilzer@apple.com> 2 3 WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN 4 <https://webkit.org/b/210238> 5 <rdar://problem/61491575> 6 7 Reviewed by Darin Adler. 8 9 * NetworkProcess/cache/NetworkCacheEntry.cpp: 10 (WebKit::NetworkCache::Entry::decodeStorageRecord): 11 - Add missing return value check for decode.decode(). 12 1 13 2020-04-09 Per Arne Vollan <pvollan@apple.com> 2 14 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp
r254514 r259814 136 136 } 137 137 138 decoder.decode(entry->m_maxAgeCap); 139 138 if (!decoder.decode(entry->m_maxAgeCap)) 139 return nullptr; 140 140 141 if (!decoder.verifyChecksum()) { 141 142 LOG(NetworkCache, "(NetworkProcess) checksum verification failure\n");
Note:
See TracChangeset
for help on using the changeset viewer.