-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1927 from ghutchis/fuzz-testing
Add some initial fuzz IO tests
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/****************************************************************************** | ||
This source file is part of the Avogadro project. | ||
This source code is released under the 3-Clause BSD License, (see "LICENSE"). | ||
******************************************************************************/ | ||
|
||
#include <avogadro/core/molecule.h> | ||
#include <avogadro/io/fileformat.h> | ||
#include <avogadro/io/fileformatmanager.h> | ||
|
||
using Avogadro::Core::Molecule; | ||
using Avogadro::Io::FileFormatManager; | ||
|
||
// FUZZ_INPUT_FORMAT is defined in the build system | ||
// e.g., "cjson", "sdf", "xyz", etc. | ||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) | ||
{ | ||
std::string input(reinterpret_cast<const char*>(Data), Size); | ||
|
||
Molecule molecule; | ||
FileFormatManager::instance().readString(molecule, input, FUZZ_INPUT_FORMAT); | ||
|
||
return 0; | ||
} |