Changeset 260861 in webkit


Ignore:
Timestamp:
Apr 28, 2020 8:03:09 PM (4 years ago)
Author:
ddkilzer@apple.com
Message:

IPC::Decoder::isValid() should just be a nullptr check
<https://webkit.org/b/211152>
<rdar://problem/62552699>

Reviewed by Darin Adler.

  • Platform/IPC/Decoder.h:

(IPC::Decoder::isValid const): Change to nullptr check. I
reviewed the code in Decoder.{cpp,h}, and I didn't see
m_bufferPos being set without a bounds check. Also added
WARN_UNUSED_RETURN to make sure the result is always checked.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r260857 r260861  
     12020-04-28  David Kilzer  <ddkilzer@apple.com>
     2
     3        IPC::Decoder::isValid() should just be a nullptr check
     4        <https://webkit.org/b/211152>
     5        <rdar://problem/62552699>
     6
     7        Reviewed by Darin Adler.
     8
     9        * Platform/IPC/Decoder.h:
     10        (IPC::Decoder::isValid const): Change to nullptr check.  I
     11        reviewed the code in Decoder.{cpp,h}, and I didn't see
     12        m_bufferPos being set without a bounds check.  Also added
     13        WARN_UNUSED_RETURN to make sure the result is always checked.
     14
    1152020-04-28  Daniel Bates  <dabates@apple.com>
    216
  • trunk/Source/WebKit/Platform/IPC/Decoder.h

    r260704 r260861  
    7272    size_t length() const { return m_bufferEnd - m_buffer; }
    7373
    74     bool isValid() const
    75     {
    76         // (m_bufferPos == m_bufferEnd) is a valid state for decoding if the last parameter
    77         // is a variable length byte array and its size == 0.
    78         return m_bufferPos >= m_buffer && m_bufferPos <= m_bufferEnd;
    79     }
     74    WARN_UNUSED_RETURN bool isValid() const { return m_bufferPos != nullptr; }
    8075    void markInvalid() { m_bufferPos = nullptr; }
    8176
Note: See TracChangeset for help on using the changeset viewer.