avoid int overflow on arches with 32bit long

Bug: https://github.com/curl/curl/pull/1748
This commit is contained in:
Kamil Dudka 2017-08-09 14:34:00 +02:00
parent 46ef14b039
commit a12eed4ad5
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,26 @@
From b478816720e1a6b909f454c421dc620e18383947 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 9 Aug 2017 14:27:05 +0200
Subject: [PATCH] curl: avoid int overflow on arches with 32bit long
This makes test1427 pass on i386.
---
src/tool_paramhlp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index b9dedc9..205c260 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -218,7 +218,7 @@ static ParameterError str2double(double *val, const char *str, long max)
num = strtod(str, &endptr);
if(errno == ERANGE)
return PARAM_NUMBER_TOO_LARGE;
- if((long)num > max) {
+ if(num > (double)LONG_MAX || (long)num > max) {
/* too large */
return PARAM_NUMBER_TOO_LARGE;
}
--
2.9.4

View File

@ -10,6 +10,10 @@ Source: https://curl.haxx.se/download/%{name}-%{version}.tar.xz
# https://github.com/curl/curl/pull/1744
Patch1: 0001-curl-7.55.0-tests-missing-py-scripts.patch
# avoid int overflow on arches with 32bit long
# https://github.com/curl/curl/pull/1748
Patch2: 0002-curl-7.55.0-32bit-overflow.patch
# patch making libcurl multilib ready
Patch101: 0101-curl-7.32.0-multilib.patch
@ -156,6 +160,9 @@ be installed.
%patch1 -p1
chmod +x tests/{dictserver,negtelnetserver}.py
# not yet upstream
%patch2 -p1
# Fedora patches
%patch101 -p1
%patch102 -p1