Changeset 248663 in webkit
- Timestamp:
- Aug 14, 2019 2:27:00 AM (5 years ago)
- Location:
- trunk/Source/WebCore/PAL
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/PAL/ChangeLog
r248469 r248663 1 2019-08-14 Youenn Fablet <youenn@apple.com> 2 3 Fail decoding an invalid SessionID 4 https://bugs.webkit.org/show_bug.cgi?id=200663 5 6 Reviewed by Alex Christensen. 7 8 * pal/SessionID.h: 9 (PAL::SessionID::isValid const): 10 (PAL::SessionID::isValidSessionIDValue): 11 (PAL::SessionID::encode const): 12 Add a release assert to catch bad sessionID senders. 13 (PAL::SessionID::decode): 14 Fail decoding if session ID is not a valid value. 15 1 16 2019-08-09 Tim Horton <timothy_horton@apple.com> 2 17 -
trunk/Source/WebCore/PAL/pal/SessionID.h
r248366 r248663 51 51 static SessionID legacyPrivateSessionID() { return SessionID(LegacyPrivateSessionID); } 52 52 53 bool isValid() const { return m_sessionID != HashTableEmptyValueID && m_sessionID != HashTableDeletedValueID; }53 bool isValid() const { return isValidSessionIDValue(m_sessionID); } 54 54 bool isEphemeral() const { return m_sessionID & EphemeralSessionMask && m_sessionID != HashTableDeletedValueID; } 55 55 … … 75 75 } 76 76 77 static bool isValidSessionIDValue(uint64_t sessionID) { return sessionID != HashTableEmptyValueID && sessionID != HashTableDeletedValueID; } 78 77 79 uint64_t m_sessionID; 78 80 }; … … 81 83 void SessionID::encode(Encoder& encoder) const 82 84 { 83 ASSERT(isValid()); 85 // FIXME: Change to a regular ASSERT. 86 RELEASE_ASSERT(isValid()); 84 87 encoder << m_sessionID; 85 88 } … … 93 96 return false; 94 97 95 sessionID = decodedSessionID.value();98 sessionID = *decodedSessionID; 96 99 return true; 97 100 } … … 102 105 Optional<uint64_t> sessionID; 103 106 decoder >> sessionID; 104 if (!sessionID )107 if (!sessionID || !isValidSessionIDValue(*sessionID)) 105 108 return WTF::nullopt; 106 109 107 // FIXME: We should fail to decode an invalid sessionID.108 ASSERT(SessionID { *sessionID }.isValid());109 110 return SessionID { *sessionID }; 110 111 }
Note: See TracChangeset
for help on using the changeset viewer.