]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
RAR5 reader: fix unsafe sign check of a bitwise operation.
authorMartin Matuska <martin@matuska.org>
Sat, 18 Jan 2020 00:18:43 +0000 (01:18 +0100)
committerMartin Matuska <martin@matuska.org>
Sat, 18 Jan 2020 00:23:49 +0000 (01:23 +0100)
This has no but code correctness effect as cdeque_init() is static
and max_capacity_power_of_2 in our code is always 8192.

Found by LGTM.com code analysis

libarchive/archive_read_support_format_rar5.c

index 26374582e4d60f37ce792e45442b73ea65628b1b..1c1cd7961abd0521be870f472e8c83c22e4256f7 100644 (file)
@@ -384,7 +384,7 @@ static int cdeque_init(struct cdeque* d, int max_capacity_power_of_2) {
        d->cap_mask = max_capacity_power_of_2 - 1;
        d->arr = NULL;
 
-       if((max_capacity_power_of_2 & d->cap_mask) > 0)
+       if((max_capacity_power_of_2 & d->cap_mask) != 0)
                return CDE_PARAM;
 
        cdeque_clear(d);