[mojo] Gracefully handle malformed message headers
A Channel message can have some extra header space for stashing e.g. encoded handle values on Windows, Mac, and Fuchsia. On those platforms the size is always validated against other header metadata. On other platforms the size is ignored and never validated. Meanwhile, when deserializing Channel messages we extract and validate some basic metadata before allocated a data buffer in which to reconstruct a sanitized message. On platforms which don't use extra header bytes, the reconstructed message will always have zero extra header bytes. In cases where we receive a malformed message on these platforms, with some non-zero extra header size, the reconstructed message's total payload size will differ from the message being deserialized. We have a DCHECK in place to assert that this never happens, and so such messages can hit the DCHECK. While this doesn't end up affecting production behavior in any meaningful way, it does break some ClusterFuzz test cases. This updates the deserialization path such that messages with extra header bytes are rejected on platforms which never use them. Bug: 968637 Change-Id: I5fa32d3c1f9208472fd899d61f91656b2a710a17 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1638882Reviewed-by:Reilly Grant <reillyg@chromium.org> Commit-Queue: Ken Rockot <rockot@google.com> Cr-Commit-Position: refs/heads/master@{#665985}
Showing
Please register or sign in to comment