aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/test/test_read_format_rar.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2019-06-17 11:29:32 +0000
committerMartin Matuska <mm@FreeBSD.org>2019-06-17 11:29:32 +0000
commitc31a08f64d5475900060540bea0d534466f88f6e (patch)
tree7151200bec01abd278d8b576cf3d11c7b9e86860 /libarchive/test/test_read_format_rar.c
parent67e87fe612adae8fa61bc9f81274099c292fa8d9 (diff)
downloadsrc-c31a08f64d5475900060540bea0d534466f88f6e.tar.gz
src-c31a08f64d5475900060540bea0d534466f88f6e.zip
Update vendor/libarchive/dist to git 809f0dc32fff7434aef45a7c688fa285c7208af7
Relevant vendor changes: PR #1212: RAR5 reader - window_mask was not updated correctly (OSS-Fuzz 15278) OSS-Fuzz 15120: RAR reader - extend use after free bugfix Add HAVE_UNLINKAT to config_freebsd.h
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=349134
Diffstat (limited to 'libarchive/test/test_read_format_rar.c')
-rw-r--r--libarchive/test/test_read_format_rar.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libarchive/test/test_read_format_rar.c b/libarchive/test/test_read_format_rar.c
index f08b06bc69a3..1425eb9a4570 100644
--- a/libarchive/test/test_read_format_rar.c
+++ b/libarchive/test/test_read_format_rar.c
@@ -3776,6 +3776,35 @@ DEFINE_TEST(test_read_format_rar_ppmd_use_after_free)
assertA(ARCHIVE_OK == archive_read_next_header(a, &ae));
assertA(archive_read_data(a, buf, sizeof(buf)) <= 0);
+ /* Test EOF */
+ assertA(1 == archive_read_next_header(a, &ae));
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
+
+DEFINE_TEST(test_read_format_rar_ppmd_use_after_free2)
+{
+ uint8_t buf[16];
+ const char* reffile = "test_read_format_rar_ppmd_use_after_free2.rar";
+
+ struct archive_entry *ae;
+ struct archive *a;
+
+ extract_reference_file(reffile);
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_filter_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_filename(a, reffile, 10240));
+
+ assertA(ARCHIVE_OK == archive_read_next_header(a, &ae));
+ assertA(archive_read_data(a, buf, sizeof(buf)) <= 0);
+ assertA(ARCHIVE_OK == archive_read_next_header(a, &ae));
+ assertA(archive_read_data(a, buf, sizeof(buf)) <= 0);
+
+ /* Test EOF */
+ assertA(1 == archive_read_next_header(a, &ae));
+
assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}