1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 20:15:00 +00:00

AK: Add trivial structure validation to SharedBuffer

If we're sharing buffers, we only want to share trivial structures
as anything else could potentially share internal pointers, which
most likely is going to cause problems due to different address
spaces.

Fix the GUI::SystemTheme structure, which was not trivial, which
is now caught at compile time.

Fixes #3650
This commit is contained in:
Tom 2020-09-30 20:00:59 -06:00 committed by Andreas Kling
parent 87f20f704c
commit 7399874479
16 changed files with 48 additions and 29 deletions

View file

@ -57,7 +57,7 @@ RefPtr<Gfx::Bitmap> Client::decode_image(const ByteBuffer& encoded_data)
return nullptr;
}
memcpy(encoded_buffer->data(), encoded_data.data(), encoded_data.size());
memcpy(encoded_buffer->data<void>(), encoded_data.data(), encoded_data.size());
encoded_buffer->seal();
encoded_buffer->share_with(server_pid());