mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +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:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user