From: Martin Matuska Date: Sat, 18 Jan 2020 00:18:43 +0000 (+0100) Subject: RAR5 reader: fix unsafe sign check of a bitwise operation. X-Git-Tag: v3.4.2~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06721c2ad050be144e4cc1719f197fbcfba438eb;p=thirdparty%2Flibarchive.git RAR5 reader: fix unsafe sign check of a bitwise operation. 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 --- diff --git a/libarchive/archive_read_support_format_rar5.c b/libarchive/archive_read_support_format_rar5.c index 26374582e..1c1cd7961 100644 --- a/libarchive/archive_read_support_format_rar5.c +++ b/libarchive/archive_read_support_format_rar5.c @@ -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);