Ensure progress.size_dl/progress.size_ul are always >= 0
Historically the default "unknown" value for progress.size_dl and
progress.size_ul has been zero, since these values are initialized
implicitly by the calloc that allocates the curl handle that these
variables are a part of. Users of curl that install progress
callbacks may expect these values to always be >= 0.
Currently it is possible for progress.size_dl and progress.size_ul
to by set to a value of -1, if Curl_pgrsSetDownloadSize() or
Curl_pgrsSetUploadSize() are passed a "size" of -1 (which a few
places currently do, and a following patch will add more). So
lets update Curl_pgrsSetDownloadSize() and Curl_pgrsSetUploadSize()
so they make sure that these variables always contain a value that
is >= 0.
Updates test579 and test599.
Signed-off-by:
Brandon Casey <drafnel@gmail.com>
Showing
- lib/ftp.c 2 additions, 2 deletionslib/ftp.c
- lib/http.c 1 addition, 1 deletionlib/http.c
- lib/imap.c 3 additions, 3 deletionslib/imap.c
- lib/pop3.c 2 additions, 2 deletionslib/pop3.c
- lib/progress.c 14 additions, 8 deletionslib/progress.c
- lib/smtp.c 2 additions, 2 deletionslib/smtp.c
- lib/ssh.c 2 additions, 2 deletionslib/ssh.c
- tests/data/test579 5 additions, 6 deletionstests/data/test579
- tests/data/test599 4 additions, 2 deletionstests/data/test599
- tests/libtest/lib599.c 12 additions, 0 deletionstests/libtest/lib599.c
Loading
Please register or sign in to comment