cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: 7.16.0 regression with large files

From: Matt Witherspoon <spoon_at_vt.edu>
Date: Thu, 11 Jan 2007 10:58:37 -0500

>> On Wed, 10 Jan 2007, Toby Peterson wrote:
>> There appears to be a regression in 7.16.0 when downloading large files.
>> Essentially, on a file larger than 4GB, it cuts off with exactly 4GB
>> remaining.

>How weird. I don't see what in libcurl that even knows about that number and
>even less would care about it. Are you sure you get a sane download from this
>server?

I can't personally test it, but I have an idea what the problem is. I noticed
this while fixing the double-copy patch I made --
Curl_read() expects a size_t sizerequested. On my system, size_t is only 4 bytes
long. Try printing out that sizerequested value in the function -- it is called
with the total expected file size remaining. So if you're requesting a 100MB
file, you'll find that variable will be 100000000. So there is likely a
wrap-around occuring here, a 5GB value will wrap around that variable. Not sure
if this is the source of the problem, but seems like a good canidate. I would
think if you changed that size_t to a curl_off_t, it would work?

-Matt

(my apologies this isn't properly replied-to, I have only been subscribing when
I see something of interest)
Received on 2007-01-11