Skip to content

Commit

Permalink
test: Don't abort fuzz test when tox_new fails.
Browse files Browse the repository at this point in the history
Right now, it can't fail, but later we want the fuzzer to randomly let
I/O functions fail, so we shouldn't assert tox_new succeeded.
  • Loading branch information
iphydf committed Apr 10, 2022
1 parent 5073882 commit 60b71ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion testing/fuzzing/bootstrap_harness.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Tox_Err_New error_new;
Tox *tox = tox_new(opts, &error_new);

assert(tox != nullptr);
if (tox == nullptr) {
// It might fail, because some I/O happens in tox_new, and the fuzzer
// might do things that make that I/O fail.
return 0;
}

assert(error_new == TOX_ERR_NEW_OK);

tox_options_free(opts);
Expand Down

0 comments on commit 60b71ad

Please sign in to comment.