mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Actually protect buffer in create_bitmap_from_bitmap_data()
We were capturing a copy of the ByteBuffer instead of moving it into the closure.
This commit is contained in:
committed by
Andreas Kling
parent
692368696f
commit
207d82f8bc
Notes:
github-actions[bot]
2025-12-27 15:41:45 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/207d82f8bc8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7244 Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/shannonbooth
@@ -18,7 +18,7 @@ GC_DEFINE_ALLOCATOR(ImageBitmap);
|
||||
[[nodiscard]] static auto create_bitmap_from_bitmap_data(Gfx::BitmapFormat const format, Gfx::AlphaType const alpha_type, u32 const width, u32 const height, u32 const pitch, ByteBuffer data)
|
||||
{
|
||||
// NB: The data is captured by value in the destruction callback lambda to ensure its lifetime.
|
||||
return Gfx::Bitmap::create_wrapper(format, alpha_type, Gfx::IntSize(width, height), pitch, data.data(), [data] { });
|
||||
return Gfx::Bitmap::create_wrapper(format, alpha_type, Gfx::IntSize(width, height), pitch, data.data(), [data = move(data)] { });
|
||||
}
|
||||
|
||||
static void serialize_bitmap(HTML::TransferDataEncoder& encoder, RefPtr<Gfx::Bitmap> const& bitmap)
|
||||
|
||||
Reference in New Issue
Block a user