From c6ad0d9c061aee3b503d3e0703a1eb5469539c09 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sun, 10 Oct 2021 12:21:17 +0100 Subject: [PATCH] Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39555 Comment out bogus code. --- xmpsdk/src/XMPUtils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xmpsdk/src/XMPUtils.cpp b/xmpsdk/src/XMPUtils.cpp index af41c18791..554ee13023 100644 --- a/xmpsdk/src/XMPUtils.cpp +++ b/xmpsdk/src/XMPUtils.cpp @@ -175,8 +175,11 @@ static bool IsLeapYear ( long year ) { +// Fix for https://github.com/Exiv2/exiv2/issues/1954: +// This code looks bogus, and it can also cause an integer overflow, so comment it out. +#if 0 if ( year < 0 ) year = -year + 1; // Fold the negative years, assuming there is a year 0. - +#endif if ( (year % 4) != 0 ) return false; // Not a multiple of 4. if ( (year % 100) != 0 ) return true; // A multiple of 4 but not a multiple of 100. if ( (year % 400) == 0 ) return true; // A multiple of 400.