xref: /llvm-project/compiler-rt/test/fuzzer/ThreeBytes.cpp (revision 2946cd701067404b99c39fb29dc9c74bd7193eb3)
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
40bc9143dSKostya Serebryany 
50bc9143dSKostya Serebryany // Find FUZ
60bc9143dSKostya Serebryany #include <cstddef>
70bc9143dSKostya Serebryany #include <cstdint>
80bc9143dSKostya Serebryany #include <cstdlib>
90bc9143dSKostya Serebryany 
LLVMFuzzerTestOneInput(const uint8_t * Data,size_t Size)100bc9143dSKostya Serebryany extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
110bc9143dSKostya Serebryany   if (Size < 3) return 0;
120bc9143dSKostya Serebryany   uint32_t x = Data[0] + 251 * Data[1] + 251 * 251 * Data[2];
130bc9143dSKostya Serebryany   if (x == 'F' + 251 * 'U' + 251 * 251 * 'Z')     abort();
140bc9143dSKostya Serebryany   return 0;
150bc9143dSKostya Serebryany }
16