]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Don't allow sparse mapping entry to pass beyond 63bit.
authorJoerg Sonnenberger <joerg@bec.de>
Tue, 5 Sep 2017 18:14:09 +0000 (20:14 +0200)
committerJoerg Sonnenberger <joerg@bec.de>
Tue, 5 Sep 2017 18:14:09 +0000 (20:14 +0200)
Reported-By: OSS-Fuzz issue 1627
libarchive/archive_read_support_format_tar.c

index 30d5bc83c3213612ae00fc899a5caf1a9ea40c87..c3b1ecb66052188749fa54377977bab3471461f7 100644 (file)
@@ -2241,7 +2241,7 @@ gnu_add_sparse_entry(struct archive_read *a, struct tar *tar,
        else
                tar->sparse_list = p;
        tar->sparse_last = p;
-       if (remaining < 0 || offset < 0) {
+       if (remaining < 0 || offset < 0 || offset > INT64_MAX - remaining) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Malformed sparse map data");
                return (ARCHIVE_FATAL);
        }