mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-05 04:58:57 +00:00
Fix interpretation of 'nan(number)' by the idl_parser (#5810)
* Parser reject "nan(n)" string as it does with nan(n) * Adjust scalar fuzzer to ignore '$schema' substrings - Scalar fuzzer ignores '$schema' substrings at the input - Added 'scalar_debug' target to simplify research of fuzzed cases * Improve formatting of './tests/fuzzer/CMakeLists.txt'
This commit is contained in:
28
tests/fuzzer/scalar_debug.cpp
Normal file
28
tests/fuzzer/scalar_debug.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <iostream>
|
||||
#include "flatbuffers/util.h"
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
std::cerr << "Usage: scalar_debug <path to fuzzer crash file>\n";
|
||||
return 0;
|
||||
}
|
||||
std::string crash_file_name(argv[1]);
|
||||
std::string crash_file_data;
|
||||
auto done =
|
||||
flatbuffers::LoadFile(crash_file_name.c_str(), true, &crash_file_data);
|
||||
if (!done) {
|
||||
std::cerr << "Can not load file: '" << crash_file_name << "'";
|
||||
return -1;
|
||||
}
|
||||
if (crash_file_data.size() < 3) {
|
||||
std::cerr << "Invalid file data: '" << crash_file_data << "'";
|
||||
return -2;
|
||||
}
|
||||
auto rc = LLVMFuzzerTestOneInput(
|
||||
reinterpret_cast<const uint8_t *>(crash_file_data.data()),
|
||||
crash_file_data.size());
|
||||
std::cout << "LLVMFuzzerTestOneInput finished with code " << rc;
|
||||
return rc;
|
||||
}
|
||||
Reference in New Issue
Block a user