2021-12-05 20:10:03 +08:00
|
|
|
#include <cassert>
|
|
|
|
|
2021-12-05 20:07:27 +08:00
|
|
|
#include "../../toxcore/tox.h"
|
|
|
|
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
|
|
Tox_Err_Options_New error_options;
|
|
|
|
|
|
|
|
struct Tox_Options *tox_options = tox_options_new(&error_options);
|
|
|
|
|
|
|
|
assert(tox_options != nullptr);
|
|
|
|
assert(error_options == TOX_ERR_OPTIONS_NEW_OK);
|
|
|
|
|
|
|
|
// pass test data to Tox
|
|
|
|
tox_options_set_savedata_data(tox_options, data, size);
|
|
|
|
tox_options_set_savedata_type(tox_options, TOX_SAVEDATA_TYPE_TOX_SAVE);
|
|
|
|
|
2022-02-14 07:25:39 +08:00
|
|
|
Tox *tox = tox_new(tox_options, nullptr);
|
2021-12-05 20:07:27 +08:00
|
|
|
|
|
|
|
tox_options_free(tox_options);
|
|
|
|
|
|
|
|
tox_kill(tox);
|
|
|
|
return 0; // Non-zero return values are reserved for future use.
|
|
|
|
}
|