summaryrefslogtreecommitdiff
path: root/libtiff/tif_dirread.c
diff options
context:
space:
mode:
authorBob Friesenhahn <bfriesen@simple.dallas.tx.us>2015-09-05 20:15:57 +0000
committerBob Friesenhahn <bfriesen@simple.dallas.tx.us>2015-09-05 20:15:57 +0000
commit54de96d2b8def260393209288fe52bdba7d9e7ca (patch)
treeeaa825c74718e84aeadc4af60a5f0ed44e3cb7f8 /libtiff/tif_dirread.c
parent878815a1f017b094bc9e6aae853f33aaebdf2dfd (diff)
downloadlibtiff-git-54de96d2b8def260393209288fe52bdba7d9e7ca.tar.gz
* libtiff/tif_dirread.c (TIFFReadDirEntryCheckRangeSlongSlong8):
Change implementation so that it does not sometimes overflow the range of a 32-bit int and to avoid a signed vs unsigned compare compiler warning.
Diffstat (limited to 'libtiff/tif_dirread.c')
-rw-r--r--libtiff/tif_dirread.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index bb0620b4..b30740d1 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -1,4 +1,4 @@
-/* $Id: tif_dirread.c,v 1.188 2015-08-29 20:39:17 bfriesen Exp $ */
+/* $Id: tif_dirread.c,v 1.189 2015-09-05 20:15:57 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -3209,19 +3209,21 @@ TIFFReadDirEntryCheckRangeSlongLong(uint32 value)
return(TIFFReadDirEntryErrOk);
}
+/* Check that the 8-byte unsigned value can fit in a 4-byte unsigned range */
static enum TIFFReadDirEntryErr
TIFFReadDirEntryCheckRangeSlongLong8(uint64 value)
{
- if (value > 0x7FFFFFFFUL)
+ if (value > 0x7FFFFFFF)
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
}
+/* Check that the 8-byte signed value can fit in a 4-byte signed range */
static enum TIFFReadDirEntryErr
TIFFReadDirEntryCheckRangeSlongSlong8(int64 value)
{
- if ((value < 0L-0x80000000UL) || (value > 0x7FFFFFFFL))
+ if ((value < 0-((int64) 0x7FFFFFFF+1)) || (value > 0x7FFFFFFF))
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);