From owner-svn-src-stable@freebsd.org Thu Jul 11 00:21:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9345C15E71DC; Thu, 11 Jul 2019 00:21:49 +0000 (UTC) (envelope-from mm@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3084E817F3; Thu, 11 Jul 2019 00:21:49 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC6021EB03; Thu, 11 Jul 2019 00:21:48 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0LmH9022067; Thu, 11 Jul 2019 00:21:48 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0LlWK022062; Thu, 11 Jul 2019 00:21:47 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201907110021.x6B0LlWK022062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 11 Jul 2019 00:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349900 - in stable/11: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/11: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Commit-Revision: 349900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3084E817F3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:21:49 -0000 Author: mm Date: Thu Jul 11 00:21:47 2019 New Revision: 349900 URL: https://svnweb.freebsd.org/changeset/base/349900 Log: MFC r349527,349538: Sync libarchive with vendor. Relevant vendor changes: PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary (OSS-Fuzz 15431) PR #1218: Fixes to sparse file handling Added: stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu - copied unchanged from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Modified: stable/11/contrib/libarchive/libarchive/archive_read.c stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c stable/11/lib/libarchive/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:21:47 2019 (r349900) @@ -844,7 +844,8 @@ archive_read_data(struct archive *_a, void *buff, size dest = (char *)buff; while (s > 0) { - if (a->read_data_remaining == 0) { + if (a->read_data_offset == a->read_data_output_offset && + a->read_data_remaining == 0) { read_buf = a->read_data_block; a->read_data_is_posix_read = 1; a->read_data_requested = s; Modified: stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:21:47 2019 (r349900) @@ -1143,6 +1143,8 @@ _archive_read_next_header2(struct archive *_a, struct t->entry_fd = -1; } + archive_entry_clear(entry); + for (;;) { r = next_entry(a, t, entry); if (t->entry_fd >= 0) { Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:21:47 2019 (r349900) @@ -623,9 +623,9 @@ static int run_arm_filter(struct rar5* rar, struct fil for(i = 0; i < flt->block_length - 3; i += 4) { uint8_t* b = &rar->cstate.window_buf[ (rar->cstate.solid_offset + - flt->block_start + i) & rar->cstate.window_mask]; + flt->block_start + i + 3) & rar->cstate.window_mask]; - if(b[3] == 0xEB) { + if(*b == 0xEB) { /* 0xEB = ARM's BL (branch + link) instruction. */ offset = read_filter_data(rar, (rar->cstate.solid_offset + flt->block_start + i) & Modified: stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:21:47 2019 (r349900) @@ -1215,3 +1215,18 @@ DEFINE_TEST(test_read_format_rar5_different_window_siz EPILOGUE(); } + +DEFINE_TEST(test_read_format_rar5_arm_filter_on_window_boundary) +{ + char buf[4096]; + PROLOGUE("test_read_format_rar5_arm_filter_on_window_boundary.rar"); + + /* Return codes of those calls are ignored, because this sample file + * is invalid. However, the unpacker shouldn't produce any SIGSEGV + * errors during processing. */ + + (void) archive_read_next_header(a, &ae); + while(0 != archive_read_data(a, buf, sizeof(buf))) {} + + EPILOGUE(); +} Copied: stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu (from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Thu Jul 11 00:21:47 2019 (r349900, copy of r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) @@ -0,0 +1,9 @@ +begin 600 test_read_format_rar5_arm_filter_on_window_boundary.rar +M4F%R(1H'`0"-[P+2``(''(`'`/[_(`#_!``"(0$``/X(TB`!'O___P@``/W_ +M_Q``_]U84%"0_P1LAFVQ9,S,M[$`20"#__\`_P#_`/G___!DSR0V2+$`20`Z +M@R[_______\I:!<**-@P70D`KB1!