You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Integer overflow on stream_notification_callback byte_max parameter with files bigger than 2GB #15034
Downloading a file from an http url using fopen, and trying to keep track of download progress using the stream_notification_callback returns a negative value in the $bytes_max parameter if the file to download is bigger than 2GB. Looks like an integer overflow.
The $bytes_transferred parameter, on the other hand, reports the size transferred correctly.
Downloaded 0 out of -301989888
Downloaded 7937 out of -301989888
Downloaded 15937 out of -301989888
Downloaded 23937 out of -301989888
...
Downloaded 3992977408 out of -301989888
But I expected this output instead:
Downloaded 0 out of 3992977408
Downloaded 7956 out of 3992977408
...
Downloaded 3992977408 out of 3992977408
My system is amd 64bits. The problem only happens when the file to download is bigger than 2GB, as it is with the iso image I used in the example (which is near 4GB in size).
Activity
ndossche commentedon Jul 19, 2024
I'll have a look
Fix phpGH-15034: Integer overflow on stream_notification_callback byt…
Fix GH-15034: Integer overflow on stream_notification_callback byte_m…
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'