ソースを参照

LibGfx/JBIG2: Add early out to composite_bitbuffer()

The halftone region decoding procedure can draw patterns completely
outside the page bitmap. I haven't seen this in practice yet (not
many files use pattern/halftone segments), but it seems like it's
possible in theory and seems like a good thing to check for.
Nico Weber 1 年間 前
コミット
aada06757b
1 ファイル変更3 行追加0 行削除
  1. 3 0
      Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp

+ 3 - 0
Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp

@@ -555,6 +555,9 @@ enum class CombinationOperator {
 
 static void composite_bitbuffer(BitBuffer& out, BitBuffer const& bitmap, Gfx::IntPoint position, CombinationOperator operator_)
 {
+    if (!IntRect { position, { bitmap.width(), bitmap.height() } }.intersects(IntRect { { 0, 0 }, { out.width(), out.height() } }))
+        return;
+
     size_t start_x = 0, end_x = bitmap.width();
     size_t start_y = 0, end_y = bitmap.height();
     if (position.x() < 0) {