tool_urlglob: fix build for old gcc versions

- Don't use __builtin_mul_overflow for GCC 4 and earlier.

The function was added in GCC 5.

Ref: https://gcc.gnu.org/gcc-5/changes.html

Reported-by: Dan Fandrich

Fixes https://github.com/curl/curl/issues/12124
Closes https://github.com/curl/curl/pull/12128
This commit is contained in:
Jay Satiro 2023-10-14 22:28:17 -04:00
parent e4de693bf6
commit 82aa0642ec

View File

@ -73,7 +73,8 @@ static int multiply(curl_off_t *amount, curl_off_t with)
sum = 0;
}
else {
#ifdef __GNUC__
#if defined(__GNUC__) && \
((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 1)))
if(__builtin_mul_overflow(*amount, with, &sum))
return 1;
#else