From: Joerg Sonnenberger Date: Sat, 29 Apr 2017 16:55:28 +0000 (+0200) Subject: Avoid signed overflow by computing in uintmax_t and casting the result. X-Git-Tag: v3.3.2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bdaaa2a232fe87dddfbe36c8ac56944c047d10d8;p=thirdparty%2Flibarchive.git Avoid signed overflow by computing in uintmax_t and casting the result. --- diff --git a/libarchive/test/test_read_format_mtree.c b/libarchive/test/test_read_format_mtree.c index a8342f557..8576d579f 100644 --- a/libarchive/test/test_read_format_mtree.c +++ b/libarchive/test/test_read_format_mtree.c @@ -183,7 +183,7 @@ test_read_format_mtree1(void) min_time = archive_entry_mtime(ae); assert(min_time <= 0); /* Simply asserting min_time - 1 > 0 breaks with some compiler optimizations. */ - t = min_time - 1; + t = (time_t)((uintmax_t)min_time - 1); assert(t > 0); assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);