Log Message
Cherry-pick r259814. rdar://problem/61888315
WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN
<https://webkit.org/b/210238>
<rdar://problem/61491575>
Reviewed by Darin Adler.
Source/WebKit:
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::decodeStorageRecord):
- Add missing return value check for decode.decode().
Source/WTF:
* wtf/persistence/PersistentCoders.cpp:
(WTF::Persistence::decodeStringText):
- Add WARN_UNUSED_RETURN.
* wtf/persistence/PersistentCoders.h:
(WTF::Persistence::Coder<Optional<T>>::decode):
(WTF::Persistence::Coder<Seconds>::decode):
(WTF::Persistence::Coder<WallTime>::decode):
- Add WARN_UNUSED_RETURN.
- Add missing return value check for
decode.decodeFixedLengthData().
* wtf/persistence/PersistentDecoder.h:
(WTF::Persistence::Decoder::decode):
(WTF::Persistence::Decoder::decodeEnum):
(WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const):
- Add WARN_UNUSED_RETURN.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
- branches/safari-609-branch/Source/WTF/ChangeLog
- branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.cpp
- branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.h
- branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentDecoder.h
- branches/safari-609-branch/Source/WebKit/ChangeLog
- branches/safari-609-branch/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp
Diff
Modified: branches/safari-609-branch/Source/WTF/ChangeLog (260196 => 260197)
--- branches/safari-609-branch/Source/WTF/ChangeLog 2020-04-16 17:39:30 UTC (rev 260196)
+++ branches/safari-609-branch/Source/WTF/ChangeLog 2020-04-16 17:44:15 UTC (rev 260197)
@@ -1,3 +1,68 @@
+2020-04-16 Alan Coon <[email protected]>
+
+ Cherry-pick r259814. rdar://problem/61888315
+
+ WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN
+ <https://webkit.org/b/210238>
+ <rdar://problem/61491575>
+
+ Reviewed by Darin Adler.
+
+ Source/WebKit:
+
+ * NetworkProcess/cache/NetworkCacheEntry.cpp:
+ (WebKit::NetworkCache::Entry::decodeStorageRecord):
+ - Add missing return value check for decode.decode().
+
+ Source/WTF:
+
+ * wtf/persistence/PersistentCoders.cpp:
+ (WTF::Persistence::decodeStringText):
+ - Add WARN_UNUSED_RETURN.
+
+ * wtf/persistence/PersistentCoders.h:
+ (WTF::Persistence::Coder<Optional<T>>::decode):
+ (WTF::Persistence::Coder<Seconds>::decode):
+ (WTF::Persistence::Coder<WallTime>::decode):
+ - Add WARN_UNUSED_RETURN.
+ - Add missing return value check for
+ decode.decodeFixedLengthData().
+
+ * wtf/persistence/PersistentDecoder.h:
+ (WTF::Persistence::Decoder::decode):
+ (WTF::Persistence::Decoder::decodeEnum):
+ (WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const):
+ - Add WARN_UNUSED_RETURN.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-04-09 David Kilzer <[email protected]>
+
+ WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN
+ <https://webkit.org/b/210238>
+ <rdar://problem/61491575>
+
+ Reviewed by Darin Adler.
+
+ * wtf/persistence/PersistentCoders.cpp:
+ (WTF::Persistence::decodeStringText):
+ - Add WARN_UNUSED_RETURN.
+
+ * wtf/persistence/PersistentCoders.h:
+ (WTF::Persistence::Coder<Optional<T>>::decode):
+ (WTF::Persistence::Coder<Seconds>::decode):
+ (WTF::Persistence::Coder<WallTime>::decode):
+ - Add WARN_UNUSED_RETURN.
+ - Add missing return value check for
+ decode.decodeFixedLengthData().
+
+ * wtf/persistence/PersistentDecoder.h:
+ (WTF::Persistence::Decoder::decode):
+ (WTF::Persistence::Decoder::decodeEnum):
+ (WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const):
+ - Add WARN_UNUSED_RETURN.
+
2020-04-12 Alan Coon <[email protected]>
Cherry-pick r259316. rdar://problem/61269751
Modified: branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.cpp (260196 => 260197)
--- branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.cpp 2020-04-16 17:39:30 UTC (rev 260196)
+++ branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.cpp 2020-04-16 17:44:15 UTC (rev 260197)
@@ -106,7 +106,7 @@
}
template <typename CharacterType>
-static inline bool decodeStringText(Decoder& decoder, uint32_t length, String& result)
+static inline WARN_UNUSED_RETURN bool decodeStringText(Decoder& decoder, uint32_t length, String& result)
{
// Before allocating the string, make sure that the decoder buffer is big enough.
if (!decoder.bufferIsLargeEnoughToContain<CharacterType>(length))
Modified: branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.h (260196 => 260197)
--- branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.h 2020-04-16 17:39:30 UTC (rev 260196)
+++ branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentCoders.h 2020-04-16 17:44:15 UTC (rev 260197)
@@ -45,7 +45,7 @@
encoder << pair.first << pair.second;
}
- static bool decode(Decoder& decoder, std::pair<T, U>& pair)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, std::pair<T, U>& pair)
{
T first;
if (!decoder.decode(first))
@@ -73,7 +73,7 @@
encoder << optional.value();
}
- static bool decode(Decoder& decoder, Optional<T>& optional)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Optional<T>& optional)
{
bool isEngaged;
if (!decoder.decode(isEngaged))
@@ -99,7 +99,7 @@
encoder << pair.key << pair.value;
}
- static bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)
{
KeyType key;
if (!decoder.decode(key))
@@ -125,7 +125,7 @@
encoder << vector[i];
}
- static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
{
uint64_t size;
if (!decoder.decode(size))
@@ -153,7 +153,7 @@
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(vector.data()), vector.size() * sizeof(T));
}
- static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
{
uint64_t decodedSize;
if (!decoder.decode(decodedSize))
@@ -170,7 +170,8 @@
Vector<T, inlineCapacity> temp;
temp.grow(size);
- decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T));
+ if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T)))
+ return false;
vector.swap(temp);
return true;
@@ -189,7 +190,7 @@
encoder << *it;
}
- static bool decode(Decoder& decoder, HashMapType& hashMap)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashMapType& hashMap)
{
uint64_t hashMapSize;
if (!decoder.decode(hashMapSize))
@@ -226,7 +227,7 @@
encoder << *it;
}
- static bool decode(Decoder& decoder, HashSetType& hashSet)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashSetType& hashSet)
{
uint64_t hashSetSize;
if (!decoder.decode(hashSetSize))
@@ -255,7 +256,7 @@
encoder << seconds.value();
}
- static bool decode(Decoder& decoder, Seconds& result)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Seconds& result)
{
double value;
if (!decoder.decode(value))
@@ -272,7 +273,7 @@
encoder << time.secondsSinceEpoch().value();
}
- static bool decode(Decoder& decoder, WallTime& result)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WallTime& result)
{
double value;
if (!decoder.decode(value))
@@ -285,22 +286,22 @@
template<> struct Coder<AtomString> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const AtomString&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomString&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomString&) WARN_UNUSED_RETURN;
};
template<> struct Coder<CString> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const CString&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&) WARN_UNUSED_RETURN;
};
template<> struct Coder<String> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const String&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&) WARN_UNUSED_RETURN;
};
template<> struct Coder<SHA1::Digest> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const SHA1::Digest&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&) WARN_UNUSED_RETURN;
};
}
Modified: branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentDecoder.h (260196 => 260197)
--- branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentDecoder.h 2020-04-16 17:39:30 UTC (rev 260196)
+++ branches/safari-609-branch/Source/WTF/wtf/persistence/PersistentDecoder.h 2020-04-16 17:44:15 UTC (rev 260197)
@@ -41,22 +41,23 @@
size_t length() const { return m_bufferEnd - m_buffer; }
size_t currentOffset() const { return m_bufferPosition - m_buffer; }
- WTF_EXPORT_PRIVATE bool verifyChecksum();
+ WTF_EXPORT_PRIVATE bool verifyChecksum() WARN_UNUSED_RETURN;
- WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t);
+ WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t) WARN_UNUSED_RETURN;
- WTF_EXPORT_PRIVATE bool decode(bool&);
- WTF_EXPORT_PRIVATE bool decode(uint8_t&);
- WTF_EXPORT_PRIVATE bool decode(uint16_t&);
- WTF_EXPORT_PRIVATE bool decode(uint32_t&);
- WTF_EXPORT_PRIVATE bool decode(uint64_t&);
- WTF_EXPORT_PRIVATE bool decode(int16_t&);
- WTF_EXPORT_PRIVATE bool decode(int32_t&);
- WTF_EXPORT_PRIVATE bool decode(int64_t&);
- WTF_EXPORT_PRIVATE bool decode(float&);
- WTF_EXPORT_PRIVATE bool decode(double&);
+ WTF_EXPORT_PRIVATE bool decode(bool&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint8_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint16_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint32_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint64_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(int16_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(int32_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(int64_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(float&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(double&) WARN_UNUSED_RETURN;
- template<typename E> auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
+ template<typename E> WARN_UNUSED_RETURN
+ auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
{
uint64_t value;
if (!decode(value))
@@ -68,7 +69,8 @@
return true;
}
- template<typename T> bool decodeEnum(T& result)
+ template<typename T> WARN_UNUSED_RETURN
+ bool decodeEnum(T& result)
{
static_assert(sizeof(T) <= 8, "Enum type T must not be larger than 64 bits!");
@@ -80,12 +82,13 @@
return true;
}
- template<typename T> auto decode(T& t) -> std::enable_if_t<!std::is_enum<T>::value, bool>
+ template<typename T> WARN_UNUSED_RETURN
+ auto decode(T& t) -> std::enable_if_t<!std::is_enum<T>::value, bool>
{
return Coder<T>::decode(*this, t);
}
- template<typename T>
+ template<typename T> WARN_UNUSED_RETURN
bool bufferIsLargeEnoughToContain(size_t numElements) const
{
static_assert(std::is_arithmetic<T>::value, "Type T must have a fixed, known encoded size!");
@@ -99,8 +102,8 @@
static constexpr bool isIPCDecoder = false;
private:
- WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const;
- template<typename Type> bool decodeNumber(Type&);
+ WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const WARN_UNUSED_RETURN;
+ template<typename Type> bool decodeNumber(Type&) WARN_UNUSED_RETURN;
const uint8_t* m_buffer;
const uint8_t* m_bufferPosition;
Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (260196 => 260197)
--- branches/safari-609-branch/Source/WebKit/ChangeLog 2020-04-16 17:39:30 UTC (rev 260196)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog 2020-04-16 17:44:15 UTC (rev 260197)
@@ -1,3 +1,54 @@
+2020-04-16 Alan Coon <[email protected]>
+
+ Cherry-pick r259814. rdar://problem/61888315
+
+ WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN
+ <https://webkit.org/b/210238>
+ <rdar://problem/61491575>
+
+ Reviewed by Darin Adler.
+
+ Source/WebKit:
+
+ * NetworkProcess/cache/NetworkCacheEntry.cpp:
+ (WebKit::NetworkCache::Entry::decodeStorageRecord):
+ - Add missing return value check for decode.decode().
+
+ Source/WTF:
+
+ * wtf/persistence/PersistentCoders.cpp:
+ (WTF::Persistence::decodeStringText):
+ - Add WARN_UNUSED_RETURN.
+
+ * wtf/persistence/PersistentCoders.h:
+ (WTF::Persistence::Coder<Optional<T>>::decode):
+ (WTF::Persistence::Coder<Seconds>::decode):
+ (WTF::Persistence::Coder<WallTime>::decode):
+ - Add WARN_UNUSED_RETURN.
+ - Add missing return value check for
+ decode.decodeFixedLengthData().
+
+ * wtf/persistence/PersistentDecoder.h:
+ (WTF::Persistence::Decoder::decode):
+ (WTF::Persistence::Decoder::decodeEnum):
+ (WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const):
+ - Add WARN_UNUSED_RETURN.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-04-09 David Kilzer <[email protected]>
+
+ WTF::Persistence::Coder and WTF::Persistence::Decoder should use WARN_UNUSED_RETURN
+ <https://webkit.org/b/210238>
+ <rdar://problem/61491575>
+
+ Reviewed by Darin Adler.
+
+ * NetworkProcess/cache/NetworkCacheEntry.cpp:
+ (WebKit::NetworkCache::Entry::decodeStorageRecord):
+ - Add missing return value check for decode.decode().
+
2020-04-15 Russell Epstein <[email protected]>
Cherry-pick r260101. rdar://problem/61853298
Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp (260196 => 260197)
--- branches/safari-609-branch/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp 2020-04-16 17:39:30 UTC (rev 260196)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp 2020-04-16 17:44:15 UTC (rev 260197)
@@ -135,8 +135,9 @@
return nullptr;
}
- decoder.decode(entry->m_maxAgeCap);
-
+ if (!decoder.decode(entry->m_maxAgeCap))
+ return nullptr;
+
if (!decoder.verifyChecksum()) {
LOG(NetworkCache, "(NetworkProcess) checksum verification failure\n");
return nullptr;
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
