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
commit 7399874479
Notes: sideshowbarker 2024-07-19 02:06:02 +09:00
16 changed files with 48 additions and 29 deletions

View file

@ -50,7 +50,7 @@ void Download::did_finish(Badge<Client>, bool success, Optional<u32> status_code
RefPtr<SharedBuffer> shared_buffer;
if (success && shbuf_id != -1) {
shared_buffer = SharedBuffer::create_from_shbuf_id(shbuf_id);
payload = ByteBuffer::wrap(shared_buffer->data(), total_size);
payload = ByteBuffer::wrap(shared_buffer->data<void>(), total_size);
}
// FIXME: It's a bit silly that we copy the response headers here just so we can move them into a HashMap with different traits.