summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYujie Qin <yujieqin@google.com>2017-05-08 10:14:37 +0200
committerYujie Qin <yujieqin@google.com>2017-05-08 20:11:31 +0000
commit1cc3bdb6e11a9a6ce4629d77960a895cfb055200 (patch)
treed49fb775bdf32dcb66fe70a228c476446d4fbe31
parent0420a20d94d620f471e47cf3f8c40facca5de58e (diff)
downloaddng_sdk-1cc3bdb6e11a9a6ce4629d77960a895cfb055200.tar.gz
Throw exception on integer overflow in dng_ifd.cpp.
Bug: 36724453 Test: manual, see b/36724453 Change-Id: I6115361002d3e4167ff7ff654e1fd2176ac24e87 (cherry picked from commit 2cb858a7ed887b231086ae81e2b35a3614299da3)
-rw-r--r--source/dng_ifd.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/dng_ifd.cpp b/source/dng_ifd.cpp
index 317ebf9..7f22065 100644
--- a/source/dng_ifd.cpp
+++ b/source/dng_ifd.cpp
@@ -3979,7 +3979,7 @@ uint32 dng_ifd::TilesAcross () const
if (fTileWidth)
{
- return (fImageWidth + fTileWidth - 1) / fTileWidth;
+ return (SafeUint32Sub(SafeUint32Add(fImageWidth, fTileWidth), 1)) / fTileWidth;
}
@@ -3995,7 +3995,7 @@ uint32 dng_ifd::TilesDown () const
if (fTileLength)
{
- return (fImageLength + fTileLength - 1) / fTileLength;
+ return (SafeUint32Sub(SafeUint32Add(fImageLength, fTileLength), 1)) / fTileLength;
}