uid-range: add assert to silence coverity

Coverity flags range->n_entries - j - 1 and j-- as potential
underflows. Add an assert that j > 0 before decrementing, since
j starts at i + 1 >= 1 and is never decremented below its
initial value.

CID#1548015

Follow-up for 8dcc66cefc
This commit is contained in:
Luca Boccassi
2026-04-07 23:45:30 +01:00
parent c9da918805
commit 1934c65108

View File

@@ -76,6 +76,9 @@ static void uid_range_coalesce(UIDRange *range) {
memmove(y, y + 1, sizeof(UIDRangeEntry) * (range->n_entries - j - 1));
range->n_entries--;
/* Silence static analyzers, j cannot be 0 here since it starts at i + 1, i.e. >= 1 */
assert(j > 0);
j--;
}
}