1 /* 2 * Copyright 2021 Code Intelligence GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <jni.h> 20 21 #include <algorithm> 22 #include <climits> 23 #include <cstddef> 24 #include <cstdint> 25 #include <cstring> 26 #include <initializer_list> 27 #include <iostream> 28 #include <string> 29 #include <type_traits> 30 #include <utility> 31 #include <vector> 32 33 namespace jazzer { 34 35 constexpr char kFuzzedDataProviderImplClass[] = 36 "com/code_intelligence/jazzer/runtime/FuzzedDataProviderImpl"; 37 38 // Registers the native methods in FuzzedDataProvider. 39 void SetUpFuzzedDataProvider(JNIEnv &env); 40 41 // Feed the FuzzedDataProvider with a new data buffer. The buffer is accessed 42 // by native code and not copied into the JVM, so this is cheap to call. 43 void FeedFuzzedDataProvider(const uint8_t *data, std::size_t size); 44 } // namespace jazzer 45