LibWeb: Assume structured deserialization creates the correct type

Most locations already make this assumption, but we had a few that would
silently ignore data mismatches. Let's just always assume the type is
correct for now. If a bad actor has a hold of our transport socket, it's
probably better to crash WebContent than to continue on with incorrect
data.

In the future, maybe we will want to throw an exception instead.
This commit is contained in:
Timothy Flynn 2025-07-17 19:51:09 -04:00 committed by Tim Flynn
parent ed71db45e7
commit d471b52b0e
Notes: github-actions[bot] 2025-07-18 14:10:28 +00:00
3 changed files with 3 additions and 10 deletions

View file

@ -210,9 +210,7 @@ WebIDL::ExceptionOr<void> ImageData::deserialization_steps(HTML::TransferDataDec
// 1. Initialize value's data attribute to the sub-deserialization of serialized.[[Data]].
auto deserialized = TRY(structured_deserialize_internal(vm, serialized, realm, memory));
if (auto* data = as_if<JS::Uint8ClampedArray>(deserialized.as_object()))
m_data = *data;
m_data = as<JS::Uint8ClampedArray>(deserialized.as_object());
// 2. Initialize value's width attribute to serialized.[[Width]].
auto width = serialized.decode<int>();