* src/progress.c (create_image): Sanitize input param 'dl_total_time'

This commit is contained in:
Tim Rühsen 2019-12-11 12:29:54 +01:00
parent ed135257b2
commit 0179138fe5

View File

@ -950,6 +950,12 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
if (progress_size < 5) if (progress_size < 5)
progress_size = 0; progress_size = 0;
// sanitize input
if (dl_total_time >= INT_MAX)
dl_total_time = INT_MAX - 1;
else if (dl_total_time < 0)
dl_total_time = 0;
if (orig_filename_cols <= MAX_FILENAME_COLS) if (orig_filename_cols <= MAX_FILENAME_COLS)
{ {
padding = MAX_FILENAME_COLS - orig_filename_cols; padding = MAX_FILENAME_COLS - orig_filename_cols;