From nobody Wed Apr 06 11:32:40 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 A67081A84AA8; Wed, 6 Apr 2022 11:32:43 +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 4KYMnQ3Zk9z4kvJ; Wed, 6 Apr 2022 11:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649244763; 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=hDnBOGGOZfsPNXIzqP6yg/4+ja5S5KwAhv1VR/BJqRo=; b=heWdsV8QFRqFaIsj5Mt5is7E+FdUwql4gblgAgvZwfNQ/vQmEZqqRNg5n2vxkBvyTcA7Rx ngGz4IwRkGmNOBpjXpXp48uNWtHpjuD4GPGnqZoj44xQx9xBHqc+ExB4fhUzMYO4dV2Xcg 845zo5NYmRwLZQgedq8cWBvr7tNVc5mJp7bHZ3yLVsLXErzCmilHDOQGCioc3tF30LM8K5 xu7VfQNI9gp5rL9rF/rWRDTisXMylb+3iBfFmK6O0bZPHd9qR08TDEHvKMtGDPvqlmfdar Ced3Itj+4oxhd24FpwJdRKkZob3wURcOzB4KpkMJcckHU3R7X2lgF8EEWQ5H6Q== 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 079711A597; Wed, 6 Apr 2022 11:32:41 +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 236BWeuA021925; Wed, 6 Apr 2022 11:32:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 236BWeJ7021924; Wed, 6 Apr 2022 11:32:40 GMT (envelope-from git) Date: Wed, 6 Apr 2022 11:32:40 GMT Message-Id: <202204061132.236BWeJ7021924@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: 9c1ad063e5d1 - releng/13.1 - 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 9c1ad063e5d14979651f7dc620cb1ea044c074f3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649244763; 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=hDnBOGGOZfsPNXIzqP6yg/4+ja5S5KwAhv1VR/BJqRo=; b=Mt8iDQ71EueZ46MKXFgAnbs+wlfrM59DeAIYjJ7OHkhRwkFqOZW8se41FrI49IgwUqIdNV mK5kby2JCcA4HUdnyje3QorCPO0n79+pOb4ACJmFEXJFFbmLryOcR0yLdrzWHSpcy/Vih6 LCt8pTr4w2EZ9kP4O42AF4y4xmX/RiiKIZFKEexObXXg2iZ/Lk3QPIfN7EE7Bvtg45Ai5J X6Rwo3thnCjXy1dVpwmtZ42P2o7dh6NmWp3Hy+lOFs/g/PAZkTkwdWslf31WXDlMJg6oky tZadibkjZEy+yY+KCXARXkG10WtsApy8BKOwSbYX+RTevHJ5SaoKqElFF/dgYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649244763; a=rsa-sha256; cv=none; b=OChxk7SUyhqN5HEY3R6HAG4D4Qidx9KkAfL93iSpTrCTmGFFQQlkbYPed4jP9iEf15QRmB K5ilckYNmGYab+Ho3T0EpfW582ypYFsItG6bF2wdrAACAz5zwtDrawjErE3YnVlMfZ/czK hNr6bUTqNvk1TwDSeFW1vqii6x8QUbCjfeJcqJzPpaR5CAaYXoMacw9ry65NHzr7Yundj+ 30lWTcbYtE2Iy8wzjXJK0Abb604gMSpW3jrfz23rINy01gW2Gec1NKZ76jM4WtLXKXbUTc P5wt2rA4xiJOPHr0B9q728p9NBxV33onzIQM2vQg8Dj5v+3c5113c60i4+H7iw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=9c1ad063e5d14979651f7dc620cb1ea044c074f3 commit 9c1ad063e5d14979651f7dc620cb1ea044c074f3 Author: Martin Matuska AuthorDate: 2022-04-03 12:21:28 +0000 Commit: Martin Matuska CommitDate: 2022-04-06 11:32:07 +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() Approved by: re (gjb) (cherry picked from commit 9f690fcfdc050f566466ac10cca29ff43bf4fe92) (cherry picked from commit 43a449f2f1feae53a1302821db6940fd364fa171) --- .../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;