test: Don't abort fuzz test when tox_new fails.

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.
This commit is contained in:
iphydf 2022-04-10 22:25:28 +00:00
parent 5073882e0f
commit 60b71adbfa
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -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);