Branch: refs/heads/webkitglib/2.48
Home: https://github.com/WebKit/WebKit
Commit: 903d8d39743fb20f007059f63235b7ad18c44c4d
https://github.com/WebKit/WebKit/commit/903d8d39743fb20f007059f63235b7ad18c44c4d
Author: Adrian Perez de Castro <[email protected]>
Date: 2025-11-19 (Wed, 19 Nov 2025)
Changed paths:
M Source/WTF/wtf/glib/SocketConnection.cpp
M Source/WTF/wtf/glib/SocketConnection.h
Log Message:
-----------
Cherry-pick 303205@main (bb3b3f72e7e2).
https://bugs.webkit.org/show_bug.cgi?id=302649
[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
Canonical link: https://commits.webkit.org/290945.412@webkitglib/2.48
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications