1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // UNSUPPORTED: c++03, c++11 |
10 | |
11 | #include <algorithm> |
12 | #include <cstddef> |
13 | #include <cstdint> |
14 | #include <vector> |
15 | |
16 | #include "fuzz.h" |
17 | |
18 | extern "C"int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { |
19 | std::vector<std::uint8_t> working(data, data + size); |
20 | std::sort(first: working.begin(), last: working.end()); |
21 | |
22 | if (!std::is_sorted(first: working.begin(), last: working.end())) |
23 | return 1; |
24 | if (!fast_is_permutation(first1: data, last1: data + size, first2: working.cbegin())) |
25 | return 99; |
26 | return 0; |
27 | } |
28 |