diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-11-05 09:58:05 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-11-06 11:13:07 +0000 |
commit | 6d4cf4b392c53e3edb8573d89b5ca4b6257bb99f (patch) | |
tree | e82ca5d06248ff92f438ed0221b8c5114f8d5c2b /src/3rdparty/libtiff/libtiff/tif_aux.c | |
parent | b722026bd89c2c0e5688131a257a5c24e70a16ed (diff) |
Update bundled libtiff to version 4.1.0
[ChangeLog][Third-Party Code] Bundled libtiff was updated to version 4.1.0
Change-Id: I3e841863c5cf8588bf62b6520f34e64909394998
(cherry picked from commit ba1fb21bc61a2075c7fd058e7f7ba5caf7d2f400)
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_aux.c')
-rw-r--r-- | src/3rdparty/libtiff/libtiff/tif_aux.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_aux.c b/src/3rdparty/libtiff/libtiff/tif_aux.c index 33fb8a4..8188db5 100644 --- a/src/3rdparty/libtiff/libtiff/tif_aux.c +++ b/src/3rdparty/libtiff/libtiff/tif_aux.c @@ -30,31 +30,28 @@ #include "tiffiop.h" #include "tif_predict.h" #include <math.h> +#include <float.h> uint32 _TIFFMultiply32(TIFF* tif, uint32 first, uint32 second, const char* where) { - uint32 bytes = first * second; - - if (second && bytes / second != first) { + if (second && first > TIFF_UINT32_MAX / second) { TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where); - bytes = 0; + return 0; } - return bytes; + return first * second; } uint64 _TIFFMultiply64(TIFF* tif, uint64 first, uint64 second, const char* where) { - uint64 bytes = first * second; - - if (second && bytes / second != first) { + if (second && first > TIFF_UINT64_MAX / second) { TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where); - bytes = 0; + return 0; } - return bytes; + return first * second; } tmsize_t @@ -396,6 +393,15 @@ _TIFFUInt64ToDouble(uint64 ui64) } } +float _TIFFClampDoubleToFloat( double val ) +{ + if( val > FLT_MAX ) + return FLT_MAX; + if( val < -FLT_MAX ) + return -FLT_MAX; + return (float)val; +} + int _TIFFSeekOK(TIFF* tif, toff_t off) { /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */ |