// libFuzzer harness for the SML parser. try_parse_sml returns // std::nullopt on a malformed input rather than throwing, so any // exception leaking is a bug. #include #include #include #include "secsgem/secs2/sml.hpp" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { std::string s(reinterpret_cast(data), size); try { auto item = secsgem::secs2::try_parse_sml(s); (void)item; } catch (...) { // try_parse_sml is contractually noexcept-equivalent — must // return nullopt, never throw. Anything escaping is a bug. __builtin_trap(); } return 0; }