| 24 | static constexpr size_t kMaxInputSize = 64 * 1024; // 64KB |
| 25 | |
| 26 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) |
| 27 | { |
| 28 | // Skip overly large inputs |
| 29 | if (size == 0 || size > kMaxInputSize) { |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | cmListFileLexer* lexer = cmListFileLexer_New(); |
| 34 | if (!lexer) { |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | // Parse from string (not file) for efficiency |
| 39 | if (cmListFileLexer_SetString(lexer, reinterpret_cast<char const*>(data), |
| 40 | size)) { |
| 41 | // Consume all tokens until EOF or error |
| 42 | cmListFileLexer_Token* token; |
| 43 | while ((token = cmListFileLexer_Scan(lexer)) != nullptr) { |
| 44 | // Access token fields to ensure they're valid |
| 45 | (void)token->type; |
| 46 | (void)token->text; |
| 47 | (void)token->length; |
| 48 | (void)token->line; |
| 49 | (void)token->column; |
| 50 | |
| 51 | // Get type as string for additional coverage |
| 52 | (void)cmListFileLexer_GetTypeAsString(lexer, token->type); |
| 53 | } |
| 54 | |
| 55 | // Exercise position tracking |
| 56 | (void)cmListFileLexer_GetCurrentLine(lexer); |
| 57 | (void)cmListFileLexer_GetCurrentColumn(lexer); |
| 58 | } |
| 59 | |
| 60 | cmListFileLexer_Delete(lexer); |
| 61 | return 0; |
| 62 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…