Browse Source

LibWeb: Fix use-after-move in `handle_successful_bitmap_decode`

Introduced in bd932858, the code would try to move `result.color_space`
into the ImmutableBitmap created for each single frame of an image. For
animated images, this would result in a use-after-move from the second
frame.
Lucas CHOLLET 7 months ago
parent
commit
2249f09267
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Libraries/LibWeb/HTML/SharedResourceRequest.cpp

+ 1 - 1
Libraries/LibWeb/HTML/SharedResourceRequest.cpp

@@ -161,7 +161,7 @@ void SharedResourceRequest::handle_successful_fetch(URL::URL const& url_string,
         Vector<AnimatedBitmapDecodedImageData::Frame> frames;
         Vector<AnimatedBitmapDecodedImageData::Frame> frames;
         for (auto& frame : result.frames) {
         for (auto& frame : result.frames) {
             frames.append(AnimatedBitmapDecodedImageData::Frame {
             frames.append(AnimatedBitmapDecodedImageData::Frame {
-                .bitmap = Gfx::ImmutableBitmap::create(*frame.bitmap, move(result.color_space)),
+                .bitmap = Gfx::ImmutableBitmap::create(*frame.bitmap, result.color_space),
                 .duration = static_cast<int>(frame.duration),
                 .duration = static_cast<int>(frame.duration),
             });
             });
         }
         }