From 533207012bfd2c5de652b9df8b2104cad82b6988 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Sun, 17 Dec 2017 17:54:28 +0100 Subject: 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 --- src/PJ_unitconvert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit v1.2.3