Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 831095

Summary: net-misc/wget-1.21.2: stabilisation (was: net-misc/wget-1.21.1 only gets 2GiB-1 bytes through http on 32-bit architectures)
Product: Gentoo Linux Reporter: Ben <blc+gentoo>
Component: StabilizationAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: sam
Priority: Normal Keywords: CC-ARCHES
Version: unspecifiedFlags: nattka: sanity-check+
Hardware: x86   
OS: Linux   
URL: https://savannah.gnu.org/bugs/?60353
Whiteboard:
Package list:
net-misc/wget-1.21.2
Runtime testing required: ---

Description Ben 2022-01-13 03:54:10 UTC
This appears to be a upstream problem.

While trying to download OpenStreetMap extract files that far exceed 2GiB, I've found that wget does not download the file and ends the download prematurely.  Continuing the download with -c allows the file to be downloaded, implying most of the code is actually correct and not a systemic problem.

Through some debug I found that it's due to improper conversion of file size to a 64-bit number.


Reproducible: Always

Steps to Reproduce:
1.Try to download a file that exceeds 2GiB through http protocol
2.
3.
Actual Results:  
Only 2GiB-1 bytes are downloaded

Expected Results:  
Whole file should be downloaded

Bug appears to be due to the use of strtol instead of strtoll.  This patch appears to fix the issue:

diff -ru wget-1.21.1/src/wget.h wget-1.21.1-hacked/src/wget.h
--- wget-1.21.1/src/wget.h      2021-01-08 15:51:43.000000000 -0700
+++ wget-1.21.1-hacked/src/wget.h       2022-01-12 20:36:08.742583104 -0700
@@ -144,7 +144,7 @@
 #define WGINT_MAX INT64_MAX
 typedef wgint SUM_SIZE_INT;
 
-#define str_to_wgint strtol
+#define str_to_wgint strtoll
 
 #include "options.h"


Note that there was a CVE related to improper use of strtol in wget but not sure if this is reverting back to improper behavior, but I don't think it is.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-13 03:57:17 UTC
Would you mind reporting this issue upstream & linking it here? Thanks!
Comment 3 Jakov Smolić archtester gentoo-dev 2022-01-13 08:33:45 UTC
amd64 done
Comment 4 Jakov Smolić archtester gentoo-dev 2022-01-13 08:33:48 UTC
x86 done
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-13 10:09:28 UTC
arm done
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-13 10:19:25 UTC
sparc done
Comment 7 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2022-01-13 18:41:54 UTC
ppc64 done
Comment 8 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2022-01-13 20:10:19 UTC
ppc done
Comment 9 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2022-01-13 20:42:14 UTC
arm64 done
Comment 10 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2022-01-14 11:26:08 UTC
hppa done

all arches done