compress: add assert for space doubling overflow safety

Coverity flags 2 * space as a potential overflow. The space value
is bounded by prior allocation success, but add an explicit assert
to document this for static analyzers.

CID#1548056

Follow-up for 5e592c66bd
This commit is contained in:
Luca Boccassi
2026-03-28 20:13:03 +00:00
parent 2bd6930efe
commit cda2962daf
+2
View File
@@ -398,6 +398,8 @@ int decompress_blob_xz(
return -ENOBUFS;
used = space - s.avail_out;
/* Silence static analyzers, space is bounded by allocation size */
assert(space <= SIZE_MAX / 2);
space = MIN(2 * space, dst_max ?: SIZE_MAX);
if (!greedy_realloc(dst, space, 1))
return -ENOMEM;