mirror of
https://github.com/flatpak/flatpak.git
synced 2026-10-28 02:20:18 -04:00
progress: Clamp to avoid unsigned underflow if fetched exceeds total
This commit is contained in:
1 parent
ab629e27e9
commit
104ed5db5e
1 file changed
+4
-1
@@ -257,7 +257,10 @@ update_status_progress_and_estimating (FlatpakProgress *self)
|
||||
* delta parts and fallback objects that were already
|
||||
* available at the start and need not be downloaded.
|
||||
*/
|
||||
total = self->total_delta_part_size - self->fetched_delta_part_size + self->total_extra_data_bytes;
|
||||
/* Clamp to avoid unsigned underflow if fetched exceeds total */
|
||||
total = self->total_delta_part_size + self->total_extra_data_bytes -
|
||||
MIN (self->fetched_delta_part_size, self->total_delta_part_size);
|
||||
|
||||
formatted_bytes_total = g_format_size_full (total, 0);
|
||||
|
||||
g_string_append_printf (buf, _("Downloading: %s/%s"),
|
||||
|
||||
Reference in new issue
Block a user