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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user