Skip to content

Commit

Permalink
libarchive: handle erroneous archives (google#9452)
Browse files Browse the repository at this point in the history
Some more codepaths were added to the fuzzer in
google#9003 However, these paths are
only valid to call in the event `archive_read_open_memory` returns
`ARCHIVE_OK` -- the fuzzer is currently blocked due to this and is why
the coverage decreased between 17th Nov to 19th Nov
(https://storage.googleapis.com/oss-fuzz-coverage/libarchive/reports/20221117/linux/src/libarchive/report.html
vs

https://storage.googleapis.com/oss-fuzz-coverage/libarchive/reports/20221119/linux/src/libarchive/report.html)

Am looking to get the coverage back up as I'm writing some documentation
about

ossf/fuzz-introspector#580 (comment)

@jvoisin could you help review?

Signed-off-by: David Korczynski <[email protected]>

Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski authored and eamonnmcmanus committed Mar 15, 2023
1 parent 91c43ac commit 321a35e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion projects/libarchive/libarchive_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {
return 0;
}

archive_read_open_memory(a, buf, len);
if (ARCHIVE_OK != archive_read_open_memory(a, buf, len)) {
archive_read_free(a);
return 0;
}

archive_read_add_passphrase(a, "secret");

while(1) {
Expand Down

0 comments on commit 321a35e

Please sign in to comment.