xref: /aosp_15_r20/external/cronet/testing/libfuzzer/fuzzers/skia_path_common.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 #ifndef TESTING_LIBFUZZER_FUZZERS_SKIA_PATH_COMMON_H_
6 #define TESTING_LIBFUZZER_FUZZERS_SKIA_PATH_COMMON_H_
7 
8 #include "third_party/skia/include/core/SkPath.h"
9 
10 template <typename T>
read(const uint8_t ** data,size_t * size,T * value)11 static bool read(const uint8_t** data, size_t* size, T* value) {
12   if (*size < sizeof(T))
13     return false;
14 
15   *value = *reinterpret_cast<const T*>(*data);
16   *data += sizeof(T);
17   *size -= sizeof(T);
18   return true;
19 }
20 
21 void BuildPath(const uint8_t** data,
22                size_t* size,
23                SkPath* path,
24                int last_verb);
25 
26 #endif  // TESTING_LIBFUZZER_FUZZERS_SKIA_PATH_COMMON_H_
27