| 28 | static constexpr size_t kMaxInputSize = 16 * 1024; // 16KB |
| 29 | |
| 30 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) |
| 31 | { |
| 32 | if (size == 0 || size > kMaxInputSize) { |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | std::string input(reinterpret_cast<char const*>(data), size); |
| 37 | |
| 38 | // Test the lexer directly |
| 39 | { |
| 40 | cmGeneratorExpressionLexer lexer; |
| 41 | auto tokens = lexer.Tokenize(input); |
| 42 | (void)tokens; |
| 43 | } |
| 44 | |
| 45 | // Test static utility functions that don't need cmake context |
| 46 | { |
| 47 | // Find generator expressions |
| 48 | auto pos = cmGeneratorExpression::Find(input); |
| 49 | (void)pos; |
| 50 | |
| 51 | // Check if starts with genex |
| 52 | bool starts = cmGeneratorExpression::StartsWithGeneratorExpression(input); |
| 53 | (void)starts; |
| 54 | |
| 55 | // Validate as target name |
| 56 | bool valid = cmGeneratorExpression::IsValidTargetName(input); |
| 57 | (void)valid; |
| 58 | |
| 59 | // Strip empty list elements |
| 60 | std::string stripped = |
| 61 | cmGeneratorExpression::StripEmptyListElements(input); |
| 62 | (void)stripped; |
| 63 | |
| 64 | // Split expressions |
| 65 | std::vector<std::string> output; |
| 66 | cmGeneratorExpression::Split(input, output); |
| 67 | |
| 68 | // Preprocess with different contexts |
| 69 | std::string preprocessed1 = cmGeneratorExpression::Preprocess( |
| 70 | input, cmGeneratorExpression::StripAllGeneratorExpressions); |
| 71 | (void)preprocessed1; |
| 72 | |
| 73 | std::string preprocessed2 = cmGeneratorExpression::Preprocess( |
| 74 | input, cmGeneratorExpression::BuildInterface); |
| 75 | (void)preprocessed2; |
| 76 | |
| 77 | std::string preprocessed3 = cmGeneratorExpression::Preprocess( |
| 78 | input, cmGeneratorExpression::InstallInterface); |
| 79 | (void)preprocessed3; |
| 80 | |
| 81 | // Collect expressions |
| 82 | std::map<std::string, std::vector<std::string>> collected; |
| 83 | std::string collResult = cmGeneratorExpression::Collect(input, collected); |
| 84 | (void)collResult; |
| 85 | } |
| 86 | |
| 87 | return 0; |
nothing calls this directly
no test coverage detected
searching dependent graphs…