From nobody Wed Dec 28 22:45:13 2022 X-Original-To: dev-commits-src-branches@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 4Nj66f01yCz2cDTQ; Wed, 28 Dec 2022 22:45:14 +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 4Nj66d6g53z3KMy; Wed, 28 Dec 2022 22:45:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672267513; 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=+efsTyxbTNamvCojKCd6q2jJ5i7v1FUdtip8ZH22O5U=; b=dOzN5MeRWi4PMnoZZqEdUnDKLS5Aw8mG+9Ns639Q+sUhli+05nm63Qkf1cGGEHjY6lpZTO 452TmZNJdN3XZDhMutuNK0/59KFM11MvneWgeV6M7g8sJHhs64aYqprM2sLbfnDqbvIwvT n7dAxayHPpme48/Go7cPIjxgW7C2/BHKMWnyS3AmBNcdBzV5aYwLHNnxDmCZ2GgABkbYkA sJeX50dPZPXkD29ycSHJ20r7jwQ7sOy1LLhapwIZDrQPskQgZadDeXdBEI159usK3J353i 3WUSLWGZwt2QFJVwl46gZ6p3PUUJK6N3aUrl1ZG8+pCTJ84L0leNCnfsfpC7Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672267513; 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=+efsTyxbTNamvCojKCd6q2jJ5i7v1FUdtip8ZH22O5U=; b=FjBnudIx2PozpU0FW+1LfaSvw1NYlBPPmTIZGgkRC+H8pHgp6xfr/HkS/m+TG7wf3GE4gv +jC8dFWAM8IhIDgPcYxcd5uaKArHgNJi/E87sR0pDlMnDYm8eU18r7L6nf0r0QE9C8bE8S oO9alNxPuPJu5ljphkUrHPN7Atc8/Ur3G+vrdSOtExdy/CzNlWVaSQaUxs1+Trl6L6uvZ1 M6BSlW7wuOlf2RZSBQcq1fzwI4WS/lDM6iVvhkBIL47c1YLABBM//uLBptIg57TChLh0px PHaB+IV2Mv3ZErGf20FETbraVNTn5QddGoDpgDo5adGF/GIHwtn+IG7C/VBBCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672267513; a=rsa-sha256; cv=none; b=js6HzFUX4DmLt+zvrg2XJ5wnOFl5ziCdvgxfnK5YCzAJfFZtEWT85oKCTqM75Y4z74Rrfa sjxSTNL71j4lLBkMBA/MHAvFwOcBKrzOSYEDt/MnwlTEmrdyeOJE1YvN1AaGZppZTYj4ox M+kMYHo9eo9jWf7Y32L3zmWxD4uVm+n3kBhSjcxVTXRCKCpFoRDjk0j+N8MatsnDkdWe8d +zKv0IaHbzKZBE3YmwM9sT7F1HZAdBdY6qWoHjnVRCqf3uRpODD41vy90jag1byVa0m6Z7 BOF764uNa3qxpBTLcunDPjJ2bcYwO5qlv4t9XW+GI4DN7ikG9ZuBeiLvjo/RCg== 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 4Nj66d5mWtz15Sl; Wed, 28 Dec 2022 22:45:13 +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 2BSMjD1b041097; Wed, 28 Dec 2022 22:45:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BSMjDdN041096; Wed, 28 Dec 2022 22:45:13 GMT (envelope-from git) Date: Wed, 28 Dec 2022 22:45:13 GMT Message-Id: <202212282245.2BSMjDdN041096@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: c237fe8275a3 - stable/11 - libarchive: merge vendor bugfixes List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/11 X-Git-Reftype: branch X-Git-Commit: c237fe8275a3532c6f9e686a9f8cf9aaeb8b168e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/11 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=c237fe8275a3532c6f9e686a9f8cf9aaeb8b168e commit c237fe8275a3532c6f9e686a9f8cf9aaeb8b168e Author: Martin Matuska AuthorDate: 2022-04-03 12:21:28 +0000 Commit: Martin Matuska CommitDate: 2022-12-28 22:15:58 +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;