diff options
author | Even Rouault <even.rouault@spatialys.com> | 2020-12-12 15:31:05 +0100 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-12 15:31:05 +0100 |
commit | 9a935c7e2350d3bd3d06fa53db58905fbae2dc63 (patch) | |
tree | d1c16703ab9c4120af538b887cc753af0fe0004d | |
parent | 39d6c91ffd147a1e37b521171a875767c547c600 (diff) | |
download | libtiff-git-9a935c7e2350d3bd3d06fa53db58905fbae2dc63.tar.gz |
DoubleToRational(): avoid casting NaN to uint32 (fixes #227)
-rw-r--r-- | libtiff/tif_dirwrite.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c index 952d107b..f481250e 100644 --- a/libtiff/tif_dirwrite.c +++ b/libtiff/tif_dirwrite.c @@ -2826,7 +2826,8 @@ void DoubleToRational(double value, uint32 *num, uint32 *denom) unsigned long long ullNum, ullDenom, ullNum2, ullDenom2; /*-- Check for negative values. If so it is an error. */ - if (value < 0) { + /* Test written that way to catch NaN */ + if (!(value >= 0)) { *num = *denom = 0; TIFFErrorExt(0, "TIFFLib: DoubleToRational()", " Negative Value for Unsigned Rational given."); return; |