From e772e31e15eaee77d147b47c41945648cc0f774b Mon Sep 17 00:00:00 2001 From: Julien Voisin Date: Thu, 17 Nov 2022 14:01:49 +0100 Subject: [PATCH] Exercises even more codepaths in libarchive --- projects/libarchive/libarchive_fuzzer.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/libarchive/libarchive_fuzzer.cc b/projects/libarchive/libarchive_fuzzer.cc index 8b7cce428137..fc7c56e78303 100644 --- a/projects/libarchive/libarchive_fuzzer.cc +++ b/projects/libarchive/libarchive_fuzzer.cc @@ -33,6 +33,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) { } archive_read_open_memory(a, buf, len); + archive_read_add_passphrase(a, "secret"); while(1) { std::vector data_buffer(getpagesize(), 0); @@ -53,11 +54,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) { (void)archive_entry_dev(entry); (void)archive_entry_digest(entry, ARCHIVE_ENTRY_DIGEST_SHA1); (void)archive_entry_filetype(entry); + (void)archive_entry_gid(entry); + (void)archive_entry_is_data_encrypted(entry); (void)archive_entry_is_encrypted(entry); + (void)archive_entry_is_metadata_encrypted(entry); (void)archive_entry_mode(entry); + (void)archive_entry_mtime(entry); (void)archive_entry_size(entry); (void)archive_entry_uid(entry); - (void)archive_entry_mtime(entry); ssize_t r; while ((r = archive_read_data(a, data_buffer.data(), @@ -67,6 +71,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) { break; } + archive_read_has_encrypted_entries(a); + archive_read_format_capabilities(a); + archive_file_count(a); + archive_seek_data(a, 0, SEEK_SET); + archive_read_free(a); return 0; }