From: Joerg Sonnenberger Date: Tue, 5 Sep 2017 18:14:09 +0000 (+0200) Subject: Don't allow sparse mapping entry to pass beyond 63bit. X-Git-Tag: v3.3.3~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db2bf93848c3759390981ac965762d13034d7ca2;p=thirdparty%2Flibarchive.git Don't allow sparse mapping entry to pass beyond 63bit. Reported-By: OSS-Fuzz issue 1627 --- diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index 30d5bc83c..c3b1ecb66 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -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); }