Explorar o código

Deps: Fix an overflow in the time conversion uncovered by oss-fuzz

Julius Pfrommer %!s(int64=5) %!d(string=hai) anos
pai
achega
12094f44f6
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      deps/libc_time.c

+ 3 - 3
deps/libc_time.c

@@ -96,9 +96,9 @@ int __month_to_secs(int month, int is_leap)
 long long __year_to_secs(long long year, int *is_leap)
 {
 	if (year-(int)2ULL <= 136) {
-		int y = (int)year;
-		int leaps = (y-68)>>2;
-		if (!((y-68)&3)) {
+		long long y = (int)year;
+		long long leaps = (y-68)>>2;
+		if (!((y-8)&3)) {
 			leaps--;
 			if (is_leap) *is_leap = 1;
 		} else if (is_leap) *is_leap = 0;