From 104ed5db5ee42c55139fbeaa5e9bcf3b8e670bec Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 30 Jun 2026 00:57:25 +0200 Subject: [PATCH] progress: Clamp to avoid unsigned underflow if fetched exceeds total --- common/flatpak-progress.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/flatpak-progress.c b/common/flatpak-progress.c index fd685e23a..61a9a72f8 100644 --- a/common/flatpak-progress.c +++ b/common/flatpak-progress.c @@ -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"),