[webkit-reviews] review granted: [Bug 211000] IPC::Decoder::isInvalid() should be renamed to isValid() : [Attachment 397529] Patch v2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 24 17:41:40 PDT 2020


Darin Adler <darin at apple.com> has granted David Kilzer (:ddkilzer)
<ddkilzer at webkit.org>'s request for review:
Bug 211000: IPC::Decoder::isInvalid() should be renamed to isValid()
https://bugs.webkit.org/show_bug.cgi?id=211000

Attachment 397529: Patch v2

https://bugs.webkit.org/attachment.cgi?id=397529&action=review




--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 397529
  --> https://bugs.webkit.org/attachment.cgi?id=397529
Patch v2

View in context: https://bugs.webkit.org/attachment.cgi?id=397529&action=review

> Source/WebKit/ChangeLog:3
> +	   IPC::Decoder::isInvalid() should be renamed to isValid()

You don’t say why

> Source/WebKit/Platform/IPC/Decoder.h:79
> -    bool isInvalid() const
> +    bool isValid() const
>      {
>	   // (m_bufferPos == m_bufferEnd) is a valid state for decoding if the
last parameter
>	   // is a variable length byte array and its size == 0.
> -	   return m_bufferPos < m_buffer || m_bufferPos > m_bufferEnd;
> +	   return m_bufferPos >= m_buffer && m_bufferPos <= m_bufferEnd;
>      }

This is a very peculiar function. Why isn’t it just a null check? If we run off
the end of the buffer, the damage has been done. Returning false from isValid
doesn’t seem to do much good.


More information about the webkit-reviews mailing list