From nobody Wed Apr 06 08:25:30 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 413371A9FA09; Wed, 6 Apr 2022 08:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KYHdR1Ksfz3j1K; Wed, 6 Apr 2022 08:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649233531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HgnkOIRkKXLxzZzK1v7MGWl0+goL2XFbY33WxN0yhKE=; b=Ilbr3W5t7sw+gAVhvFhhmKeUIrTV4QvdhP1pGY1wmmtWu1nUwfKklMhyVzcUnupIJRNy7n FXF746L77g3ShIboZao5yd94xBH++LmUuSLVzZOM2sdF/tpJ5rEDZFtLC8uBtQ3sWcpzpu 3odBqYtBqJMRzNXesQ5ppoQR/kNxf5y0mLqeLFfJVZ+0SZ6LkoIz3zKWxLKuzws/Y2tJja 2tHKrtyT2JHNrW/6v0dftfgGmFvNvK/V49pVO8asfiCEs148j7yM6SlsLB4kTfAaNrgP+W +BnTo7CBPJX3C55eh4VxJlC+zve45f0uuU4Emt8FeIExVR80CONkWonm08kIVQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0368017C24; Wed, 6 Apr 2022 08:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2368PU8k066189; Wed, 6 Apr 2022 08:25:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2368PUHZ066188; Wed, 6 Apr 2022 08:25:30 GMT (envelope-from git) Date: Wed, 6 Apr 2022 08:25:30 GMT Message-Id: <202204060825.2368PUHZ066188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 43a449f2f1fe - stable/13 - libarchive: merge vendor bugfixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 43a449f2f1feae53a1302821db6940fd364fa171 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649233531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HgnkOIRkKXLxzZzK1v7MGWl0+goL2XFbY33WxN0yhKE=; b=UBL1dY2/UjQY/pgTsHa8FvkQ0qg/A3pIl4B8IjGHAiUH5HkSd7UZdbzLkZIKibio3QSHZ8 cQwnMErVO1blK3bXIVL9jAtyWFWqyn4lF1Gozbey+IYXfSxc3s8xD7aVUM2yNFY+Zfujmo E6bIhfbwaqiB5rdBshH448yMzSeJ3qrFWzV0wQ3gyFyrXQp6yO2j/zEjlWp4R6wZA9DFUK GH97iNl4m7HfIhHdnls1oz1VTUAxmPrAWFANF6HUEZAwfp4YECcISV2rJUWNeGTgHWVAFx q+nSNkb9nkNHVXD1qxx8IoBnmdp23KCOMU8JnOdAA3FHu69WooCvhvXDItsEsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649233531; a=rsa-sha256; cv=none; b=dg5IeoyZIosPs9jj4G+tr9mztCDxxRMJIFgH92RFdY03euq4TsM16L0sccnVg5eifVcoqI 5nbdSPwtP3gjIWtRaFrubUyZmPHhvm9xMuGBMmF7I7kDHHqjThBW+Zmr/ZZ0/EWj8LE4+2 1AlfLjdD9CHFoRRpnDr2p2u9l1gqMKrHQSLc17AcXcwFpZTJRkaGCMXI0m9erpxqcd0BTH rFYwNmW5CdyeqNYYbfjrBtWz0DVL9M/gBZ0ZcEecJkgWJlTOepqFSCSWlxpPSaU3zXp0fV SiuDYbdR7uwwMknyJMK+pddqzc1t+mCyAI/Bq+oVEludqQF6nH38HxcOwVCMGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=43a449f2f1feae53a1302821db6940fd364fa171 commit 43a449f2f1feae53a1302821db6940fd364fa171 Author: Martin Matuska AuthorDate: 2022-04-03 12:21:28 +0000 Commit: Martin Matuska CommitDate: 2022-04-06 08:24:00 +0000 libarchive: merge vendor bugfixes Bugfixes: IS #1685 and OSS-Fuzz #38764 (security): (ISO reader) fix possible heap buffer overflow in read_children() IS #1715 and OSS-Fuzz #46279 (security): (RARv4 reader) fix heap-use-after-free in run_filters() (cherry picked from commit 9f690fcfdc050f566466ac10cca29ff43bf4fe92) --- .../libarchive/archive_read_support_format_iso9660.c | 3 ++- .../libarchive/archive_read_support_format_rar.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c b/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c index 806f36cbe10b..15ded7c561e5 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c @@ -1007,7 +1007,8 @@ read_children(struct archive_read *a, struct file_info *parent) p = b; b += iso9660->logical_block_size; step -= iso9660->logical_block_size; - for (; *p != 0 && p < b && p + *p <= b; p += *p) { + for (; *p != 0 && p + DR_name_offset < b && p + *p <= b; + p += *p) { struct file_info *child; /* N.B.: these special directory identifiers diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar.c b/contrib/libarchive/libarchive/archive_read_support_format_rar.c index 7a7318522650..f9cbe2a8810d 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_rar.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_rar.c @@ -3328,6 +3328,7 @@ run_filters(struct archive_read *a) struct rar *rar = (struct rar *)(a->format->data); struct rar_filters *filters = &rar->filters; struct rar_filter *filter = filters->stack; + struct rar_filter *f; size_t start, end; int64_t tend; uint32_t lastfilteraddress; @@ -3345,6 +3346,22 @@ run_filters(struct archive_read *a) ret = expand(a, &tend); if (ret != ARCHIVE_OK) return 0; + + /* Check if filter stack was modified in expand() */ + ret = ARCHIVE_FATAL; + f = filters->stack; + while (f) + { + if (f == filter) + { + ret = ARCHIVE_OK; + break; + } + f = f->next; + } + if (ret != ARCHIVE_OK) + return 0; + if (tend < 0) return 0; end = (size_t)tend;