Skip to content

Conversation

@jonathonf
Copy link
Contributor

SIZEOF_OFF_T is a macro that is not defined. This means the use of OFF_T_PF can be flaky which can lead to incorrect value parsing. For example:

sscanf(p, "bytes " OFF_T_PF "-" OFF_T_PF "/", &from, &to);

leads to

zsync_legacy: bytes 21975040-22482943/2388979712
zsync_legacy: failed to parse content-range header 1079950701759516672 - 22482943

Rather than define this macro, this change forces the use of a 64-bit integer via PRIu64 or %llu to support larger range requests. In my testing this makes request range parsing much more robust.

@jonathonf jonathonf changed the title Try to ensure OFF_T_PF use doesn't overflow Make OFF_T_PF less flaky Apr 8, 2021
@jonathonf jonathonf marked this pull request as draft April 8, 2021 21:24
@jonathonf jonathonf marked this pull request as ready for review April 8, 2021 21:38
@TheAssassin
Copy link
Member

The joy of C...

@TheAssassin TheAssassin merged commit f0bc205 into AppImageCommunity:master Apr 8, 2021
@jonathonf jonathonf deleted the large-files branch April 9, 2021 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants