diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2017-12-17 17:54:28 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2017-12-17 17:54:28 +0100 |
| commit | 533207012bfd2c5de652b9df8b2104cad82b6988 (patch) | |
| tree | 24877501f46d46cc7b477aa32f5be634116df65e | |
| parent | 9ede4c65a92781ab4c1be5b0adac81ba593bfa8c (diff) | |
| download | PROJ-533207012bfd2c5de652b9df8b2104cad82b6988.tar.gz PROJ-533207012bfd2c5de652b9df8b2104cad82b6988.zip | |
Fix integer overflow in unitconvert.
For sufficiently large values of modified julian date the
mjd_to_yyyymmdd function would integer overflow in the calculation of
the return value. This is fixed by implicit type conversion.
Credit to OSS-Fuzz.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4658 and
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4667
| -rw-r--r-- | src/PJ_unitconvert.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/PJ_unitconvert.c b/src/PJ_unitconvert.c index 36461150..fc90821b 100644 --- a/src/PJ_unitconvert.c +++ b/src/PJ_unitconvert.c @@ -252,7 +252,7 @@ static double mjd_to_yyyymmdd(double mjd) { day = (int)(mjd - mjd_iter + 1); - return year*10000 + month*100 + day; + return year*10000.0 + month*100.0 + day; } |
