1 // Copyright 2016 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifdef UNSAFE_BUFFERS_BUILD 6 // TODO(crbug.com/351564777): Remove this and convert code to safer constructs. 7 #pragma allow_unsafe_buffers 8 #endif 9 10 #ifndef TESTING_LIBFUZZER_FUZZERS_SKIA_PATH_COMMON_H_ 11 #define TESTING_LIBFUZZER_FUZZERS_SKIA_PATH_COMMON_H_ 12 13 #include "third_party/skia/include/core/SkPath.h" 14 15 template <typename T> read(const uint8_t ** data,size_t * size,T * value)16static bool read(const uint8_t** data, size_t* size, T* value) { 17 if (*size < sizeof(T)) 18 return false; 19 20 *value = *reinterpret_cast<const T*>(*data); 21 *data += sizeof(T); 22 *size -= sizeof(T); 23 return true; 24 } 25 26 void BuildPath(const uint8_t** data, 27 size_t* size, 28 SkPath* path, 29 int last_verb); 30 31 #endif // TESTING_LIBFUZZER_FUZZERS_SKIA_PATH_COMMON_H_ 32