From db2bf93848c3759390981ac965762d13034d7ca2 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 5 Sep 2017 20:14:09 +0200 Subject: [PATCH] Don't allow sparse mapping entry to pass beyond 63bit. Reported-By: OSS-Fuzz issue 1627 --- libarchive/archive_read_support_format_tar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.47.2