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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageReader.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
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageReader.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageReader.cpp b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageReader.cpp
index 0ee27a6cd0630716f58445f3d3dfc4242a98b676..f244e9b36eeabb949b9fd823873dc0e16271a386 100644
--- a/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageReader.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageReader.cpp
@@ -307,6 +307,11 @@ bool BMPImageReader::readInfoHeader()
// Detect top-down BMPs.
if (m_infoHeader.biHeight < 0) {
+ // We can't negate INT32_MIN below to get a positive int32_t.
+ // isInfoHeaderValid() will reject heights of 1 << 16 or larger anyway,
+ // so just reject this bitmap now.
+ if (m_infoHeader.biHeight == INT32_MIN)
+ return m_parent->setFailed();
m_isTopDown = true;
m_infoHeader.biHeight = -m_infoHeader.biHeight;
}
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageDecoderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698