From 4bc4757404253abb168f86bc49edbe6d36b11eb6 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Fri, 15 Oct 2021 21:55:22 +0100 Subject: [PATCH] Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39555 Remove bogus code. --- xmpsdk/src/XMPUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmpsdk/src/XMPUtils.cpp b/xmpsdk/src/XMPUtils.cpp index af41c187..89afd3d6 100644 --- a/xmpsdk/src/XMPUtils.cpp +++ b/xmpsdk/src/XMPUtils.cpp @@ -174,8 +174,8 @@ XMP_VarString * sExtendedDigest = 0; static bool IsLeapYear ( long year ) { - - if ( year < 0 ) year = -year + 1; // Fold the negative years, assuming there is a year 0. + // This code uses the Gregorian calendar algorithm: + // https://en.wikipedia.org/wiki/Leap_year#Algorithm 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.