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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // during processBitmasks(). 300 // during processBitmasks().
301 if (isWindowsV4Plus()) { 301 if (isWindowsV4Plus()) {
302 m_bitMasks[0] = readUint32(40); 302 m_bitMasks[0] = readUint32(40);
303 m_bitMasks[1] = readUint32(44); 303 m_bitMasks[1] = readUint32(44);
304 m_bitMasks[2] = readUint32(48); 304 m_bitMasks[2] = readUint32(48);
305 m_bitMasks[3] = readUint32(52); 305 m_bitMasks[3] = readUint32(52);
306 } 306 }
307 307
308 // Detect top-down BMPs. 308 // Detect top-down BMPs.
309 if (m_infoHeader.biHeight < 0) { 309 if (m_infoHeader.biHeight < 0) {
310 if (m_infoHeader.biHeight == INT32_MIN)
Peter Kasting 2016/08/17 22:21:24 Nit: I think this deserves a comment, e.g.: We ca
aleksandar.stojiljkovic 2016/08/18 21:31:00 Done.
311 return false;
Peter Kasting 2016/08/17 22:21:24 You need to return m_parent->setFailed() here, not
aleksandar.stojiljkovic 2016/08/18 21:31:00 Done. Thanks. Although the returned false gets pro
310 m_isTopDown = true; 312 m_isTopDown = true;
311 m_infoHeader.biHeight = -m_infoHeader.biHeight; 313 m_infoHeader.biHeight = -m_infoHeader.biHeight;
312 } 314 }
313 315
314 return true; 316 return true;
315 } 317 }
316 318
317 bool BMPImageReader::isInfoHeaderValid() const 319 bool BMPImageReader::isInfoHeaderValid() const
318 { 320 {
319 // Non-positive widths/heights are invalid. (We've already flipped the 321 // Non-positive widths/heights are invalid. (We've already flipped the
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 // Finished decoding whole image. 814 // Finished decoding whole image.
813 return Success; 815 return Success;
814 } 816 }
815 817
816 void BMPImageReader::moveBufferToNextRow() 818 void BMPImageReader::moveBufferToNextRow()
817 { 819 {
818 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); 820 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1);
819 } 821 }
820 822
821 } // namespace blink 823 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698