// SLeeLa Terminal lexer/parser/expansion fuzz harness. // Build with: make fuzz #include "lexer.hpp" #include "parser.hpp" #include "expand.hpp" #include #include #include #include extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, std::size_t size) { // Keep each fuzz case bounded so pathological inputs test implementation // safety rather than consume unbounded resources. if (size > (1u << 16)) size = (1u << 16); std::string source(reinterpret_cast(data), size); std::vector tokens; sleela::sh::LexError lexError; if (sleela::sh::lex(source, tokens, lexError)) { sleela::sh::ParseError parseError; (void)sleela::sh::parse(tokens, parseError); } // Exercise expansion with a fresh bounded environment. Command substitution // is disabled in this harness so arbitrary fuzz input cannot execute code. sleela::sh::Environment env; (void)sleela::sh::expandWord(source, env, nullptr); return 0; }