mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:57:43 +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:
parent
87f20f704c
commit
7399874479
16 changed files with 48 additions and 29 deletions
|
@ -90,7 +90,7 @@ Clipboard::DataAndType Clipboard::data_and_type() const
|
|||
dbgprintf("GUI::Clipboard::data() clipping contents size is greater than shared buffer size\n");
|
||||
return {};
|
||||
}
|
||||
auto data = ByteBuffer::copy(shared_buffer->data(), response->data_size());
|
||||
auto data = ByteBuffer::copy(shared_buffer->data<void>(), response->data_size());
|
||||
auto type = response->mime_type();
|
||||
auto metadata = response->metadata().entries();
|
||||
return { data, type, metadata };
|
||||
|
@ -104,7 +104,7 @@ void Clipboard::set_data(ReadonlyBytes data, const String& type, const HashMap<S
|
|||
return;
|
||||
}
|
||||
if (!data.is_empty())
|
||||
memcpy(shared_buffer->data(), data.data(), data.size());
|
||||
memcpy(shared_buffer->data<void>(), data.data(), data.size());
|
||||
shared_buffer->seal();
|
||||
shared_buffer->share_with(connection().server_pid());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue