From 207d82f8bc8863037586471eee792a35ca11bf67 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 27 Dec 2025 15:58:38 +0100 Subject: [PATCH] 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. --- Libraries/LibWeb/HTML/ImageBitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/HTML/ImageBitmap.cpp b/Libraries/LibWeb/HTML/ImageBitmap.cpp index 5cbfb3d6c0a..da28b4b2784 100644 --- a/Libraries/LibWeb/HTML/ImageBitmap.cpp +++ b/Libraries/LibWeb/HTML/ImageBitmap.cpp @@ -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 const& bitmap)