]> granicus.if.org Git - curl/commit
tool_cb_prg: Fix integer overflow in progress bar
authorDaniel Gustafsson <daniel@yesql.se>
Mon, 10 Jun 2019 07:32:30 +0000 (09:32 +0200)
committerDaniel Gustafsson <daniel@yesql.se>
Mon, 10 Jun 2019 07:32:30 +0000 (09:32 +0200)
commit6df5f35e6ac5f0f1adf7e5c7bf4bd2ec87b9d4bb
treee91a94d32ce994618b4fe69241daf3ccd9ed964f
parentdeb9462ff2de8e955c67ed441f5f48619a31198d
tool_cb_prg: Fix integer overflow in progress bar

Commit 61faa0b420c236480bc9ef6fd52b4ecc1e0f8d17 fixed the progress bar
width calculation to avoid integer overflow, but failed to account for
the fact that initial_size is initialized to -1 when the file size is
retrieved from the remote on an upload, causing another signed integer
overflow.  Fix by separately checking for this case before the width
calculation.

Closes #3984
Reported-by: Brian Carpenter (Geeknik Labs)
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
src/tool_cb_prg.c