Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bb3b3f72e7e2b20c13958c615956be41e893c6e5
      
https://github.com/WebKit/WebKit/commit/bb3b3f72e7e2b20c13958c615956be41e893c6e5
  Author: Adrian Perez de Castro <[email protected]>
  Date:   2025-11-18 (Tue, 18 Nov 2025)

  Changed paths:
    M Source/WTF/wtf/glib/SocketConnection.cpp
    M Source/WTF/wtf/glib/SocketConnection.h

  Log Message:
  -----------
  [GLib] Drop WTF_ALLOW_UNSAFE_BUFFER_USAGE in SocketConnection::readMessage()
https://bugs.webkit.org/show_bug.cgi?id=302649

Reviewed by Michael Catanzaro.

Use spans over the received message buffer to parse the different
elements of the message, advancing over the input idiomatically using
consumeAndReinterpretCastTo(), consumeSpan(), and skip().

Note that the message body size is always extended from uint32_t to a
size_t, and that the value is never modified and therefore it does not
need to be Checked<size_t> because there is no arithmetic performed on
it.

While at it, check and detect for messages missing the message name
delimiter, too short messages, or messages larger than 512 MiB (assuming
that no message will ever need to be that big). When an invalid message
is detected, use the new didReceiveInvalidMessage() helper to report it,
close the connection, and discard the read buffer.

* Source/WTF/wtf/glib/SocketConnection.cpp:
(WTF::SocketConnection::didReceiveInvalidMessage): Added.
(WTF::SocketConnection::readMessage): Modernize to use spans and add
additional sanity checks.
* Source/WTF/wtf/glib/SocketConnection.h: Added didReceiveInvalidMessage
declaration.

Canonical link: https://commits.webkit.org/303205@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to