]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_urlglob: fix build for old gcc versions
authorJay Satiro <raysatiro@yahoo.com>
Sun, 15 Oct 2023 02:28:17 +0000 (22:28 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Sun, 15 Oct 2023 18:39:42 +0000 (14:39 -0400)
- 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

src/tool_urlglob.c

index 72eab82ce0361ac24f1099c6418df4aa6323fc73..c3840feaa11b22ad86c613397ca9f1f424e748b4 100644 (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