1*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 2*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 3*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 439b6ba9fSJonathan Metzman 539b6ba9fSJonathan Metzman // Simple test for a fuzzer. Tests that fuzzer can read a file containing 639b6ba9fSJonathan Metzman // carriage returns. 739b6ba9fSJonathan Metzman #include <cstddef> 839b6ba9fSJonathan Metzman #include <cstdint> 939b6ba9fSJonathan Metzman #include <iostream> 1039b6ba9fSJonathan Metzman #include <string> 1139b6ba9fSJonathan Metzman LLVMFuzzerTestOneInput(const uint8_t * Data,size_t Size)1239b6ba9fSJonathan Metzmanextern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) { 1339b6ba9fSJonathan Metzman std::string InputStr(reinterpret_cast<const char*>(Data), Size); 1439b6ba9fSJonathan Metzman std::string MagicStr("Hello\r\nWorld\r\n"); 1539b6ba9fSJonathan Metzman if (InputStr == MagicStr) { 1639b6ba9fSJonathan Metzman std::cout << "BINGO!"; 1739b6ba9fSJonathan Metzman } 1839b6ba9fSJonathan Metzman return 0; 1939b6ba9fSJonathan Metzman } 20