[webkit-reviews] review granted: [Bug 227606] Use more Span : [Attachment 433010] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 7 10:02:55 PDT 2021


Darin Adler <darin at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 227606: Use more Span
https://bugs.webkit.org/show_bug.cgi?id=227606

Attachment 433010: Patch

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




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

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

> Source/WTF/wtf/persistence/PersistentDecoder.cpp:73
> +    // FIXME: check for underflow.
> +    if (m_bufferPosition - size >= m_buffer.begin()) {

Since we know that m_bufferPosition is >= m_buffer.begin(), we can sidestep the
possibility of overflow without adding an additional check by writing this:

    if (size <= m_bufferPosition - m_buffer.begin()) {

> Source/WebKit/NetworkProcess/cache/NetworkCacheData.h:77
>      const uint8_t* data() const;
>      size_t size() const { return m_size; }

Maybe drop these eventually?


More information about the webkit-reviews mailing list