MCPcopy Create free account
hub / github.com/Taywee/args / LLVMFuzzerTestOneInput

Function LLVMFuzzerTestOneInput

fuzz/numeric_parser_fuzzer.cpp:40–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
41 // Create a string from fuzzer input, preserving embedded NULs
42 std::string input(reinterpret_cast<const char*>(data), size);
43
44 args::ValueReader reader;
45
46 // Character-ish types (istringstream-based paths)
47 g_sink += static_cast<unsigned long>(AttemptConversion<bool>(reader, input));
48 g_sink += static_cast<unsigned long>(AttemptConversion<char>(reader, input));
49 g_sink += static_cast<unsigned long>(AttemptConversion<signed char>(reader, input));
50 g_sink += static_cast<unsigned long>(AttemptConversion<unsigned char>(reader, input));
51
52 // Test signed integer types (strtoll-based path, narrowing checks)
53 g_sink += static_cast<unsigned long>(AttemptConversion<short>(reader, input));
54 g_sink += static_cast<unsigned long>(AttemptConversion<int>(reader, input));
55 g_sink += static_cast<unsigned long>(AttemptConversion<long>(reader, input));
56 g_sink += static_cast<unsigned long>(AttemptConversion<long long>(reader, input));
57
58 // Test unsigned integer types (strtoull-based path, sign rejection)
59 g_sink += static_cast<unsigned long>(AttemptConversion<unsigned short>(reader, input));
60 g_sink += static_cast<unsigned long>(AttemptConversion<unsigned int>(reader, input));
61 g_sink += static_cast<unsigned long>(AttemptConversion<unsigned long>(reader, input));
62 g_sink += static_cast<unsigned long>(AttemptConversion<unsigned long long>(reader, input));
63
64 // Test floating point types (istringstream-based path)
65 g_sink += static_cast<unsigned long>(AttemptConversion<float>(reader, input));
66 g_sink += static_cast<unsigned long>(AttemptConversion<double>(reader, input));
67 g_sink += static_cast<unsigned long>(AttemptConversion<long double>(reader, input));
68
69 return 0;
70}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected