Skip to content

Commit

Permalink
Exercises even more codepaths in libarchive (google#9003)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Voisin <[email protected]>
  • Loading branch information
2 people authored and eamonnmcmanus committed Mar 15, 2023
1 parent 8f79847 commit 97b6ea9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion projects/libarchive/libarchive_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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<uint8_t> data_buffer(getpagesize(), 0);
Expand All @@ -54,11 +55,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(),
Expand All @@ -68,6 +72,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;
}

0 comments on commit 97b6ea9

Please sign in to comment.