Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Unified Diff: third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp

Issue 2248383002: Fix integer overflow (-INT_MIN) in blink::BMPImageReader::readInfoHeader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove 1x-1 bmp test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
index 14b399a36edadf0050deb7f5a5abbbcfc8b620a7..0661160122ce916a72f2c29a28d32c9ef31b917e 100644
--- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp
@@ -67,6 +67,17 @@ TEST(BMPImageDecoderTest, emptyImage)
EXPECT_TRUE(decoder->failed());
}
+TEST(BMPImageDecoderTest, int32MinHeight)
+{
+ const char* bmpFile = "/LayoutTests/fast/images/resources/1xint32_min.bmp"; // 0xINT32_MIN
+ RefPtr<SharedBuffer> data = readFile(bmpFile);
+ std::unique_ptr<ImageDecoder> decoder = createDecoder();
+ // Test when not all data is received.
+ decoder->setData(data.get(), false);
+ EXPECT_FALSE(decoder->isSizeAvailable());
+ EXPECT_TRUE(decoder->failed());
+}
+
// This test verifies that calling SharedBuffer::mergeSegmentsIntoBuffer() does
// not break BMP decoding at a critical point: in between a call to decode the
// size (when BMPImageDecoder stops while it may still have input data to

Powered by Google App Engine
This is Rietveld 408576698