/src/libwebp/tests/fuzzer/fuzz_utils.h
Line | Count | Source |
1 | | // Copyright 2018-2024 Google LLC |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | // |
15 | | //////////////////////////////////////////////////////////////////////////////// |
16 | | |
17 | | #ifndef WEBP_TESTS_FUZZER_FUZZ_UTILS_H_ |
18 | | #define WEBP_TESTS_FUZZER_FUZZ_UTILS_H_ |
19 | | |
20 | | #include <algorithm> |
21 | | #include <array> |
22 | | #include <cassert> |
23 | | #include <cstddef> |
24 | | #include <cstdint> |
25 | | #include <cstdlib> |
26 | | #include <cstring> |
27 | | #include <optional> |
28 | | #include <string> |
29 | | #include <string_view> |
30 | | #include <utility> |
31 | | #include <vector> |
32 | | |
33 | | #include "./img_alpha.h" |
34 | | #include "./img_grid.h" |
35 | | #include "./img_peak.h" |
36 | | #include "fuzztest/fuzztest.h" |
37 | | #include "src/dsp/cpu.h" |
38 | | #include "src/webp/decode.h" |
39 | | #include "src/webp/encode.h" |
40 | | #include "src/webp/types.h" |
41 | | |
42 | | namespace fuzz_utils { |
43 | | |
44 | | //------------------------------------------------------------------------------ |
45 | | // Arbitrary limits to prevent OOM, timeout, or slow execution. |
46 | | |
47 | | // The decoded image size, and for animations additionally the canvas size. |
48 | | // Enabling some sanitizers slow down runtime significantly. |
49 | | // Use a very low threshold in this case to avoid timeouts. |
50 | | #if defined(__SANITIZE_ADDRESS__) // GCC |
51 | | static const size_t kFuzzPxLimit = 1024 * 1024 / 10; |
52 | | #elif !defined(__has_feature) // Clang |
53 | | static const size_t kFuzzPxLimit = 1024 * 1024; |
54 | | #elif __has_feature(address_sanitizer) || __has_feature(memory_sanitizer) |
55 | | static const size_t kFuzzPxLimit = 1024 * 1024 / 18; |
56 | | #else |
57 | | static const size_t kFuzzPxLimit = 1024 * 1024; |
58 | | #endif |
59 | | |
60 | | // Demuxed or decoded animation frames. |
61 | | static const int kFuzzFrameLimit = 3; |
62 | | |
63 | | // Reads and sums (up to) 128 spread-out bytes. |
64 | 13.2k | static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) { |
65 | 13.2k | uint8_t value = 0; |
66 | 13.2k | size_t incr = size / 128; |
67 | 13.2k | if (!incr) incr = 1; |
68 | 582k | for (size_t i = 0; i < size; i += incr) value += data[i]; |
69 | 13.2k | return value; |
70 | 13.2k | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: enc_dec_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: animencoder_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: enc_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Unexecuted instantiation: dec_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) advanced_api_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Line | Count | Source | 64 | 8.24k | static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) { | 65 | 8.24k | uint8_t value = 0; | 66 | 8.24k | size_t incr = size / 128; | 67 | 8.24k | if (!incr) incr = 1; | 68 | 380k | for (size_t i = 0; i < size; i += incr) value += data[i]; | 69 | 8.24k | return value; | 70 | 8.24k | } |
simple_api_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Line | Count | Source | 64 | 4.96k | static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) { | 65 | 4.96k | uint8_t value = 0; | 66 | 4.96k | size_t incr = size / 128; | 67 | 4.96k | if (!incr) incr = 1; | 68 | 201k | for (size_t i = 0; i < size; i += incr) value += data[i]; | 69 | 4.96k | return value; | 70 | 4.96k | } |
|
71 | | |
72 | | #ifdef __cplusplus |
73 | | extern "C" VP8CPUInfo VP8GetCPUInfo; |
74 | | #else |
75 | | extern VP8CPUInfo VP8GetCPUInfo; |
76 | | #endif |
77 | | |
78 | | //------------------------------------------------------------------------------ |
79 | | |
80 | | constexpr const uint8_t* kImagesData[] = {kImgAlphaData, kImgGridData, |
81 | | kImgPeakData}; |
82 | | constexpr size_t kNumSourceImages = |
83 | | sizeof(kImagesData) / sizeof(kImagesData[0]); |
84 | | |
85 | | WebPPicture GetSourcePicture(int image_index, bool use_argb); |
86 | | |
87 | | // Struct to use in a unique_ptr to free the memory. |
88 | | struct UniquePtrDeleter { |
89 | 53.6k | void operator()(WebPMemoryWriter* writer) const { |
90 | 53.6k | WebPMemoryWriterClear(writer); |
91 | 53.6k | } |
92 | 0 | void operator()(WebPPicture* pic) const { WebPPictureFree(pic); } |
93 | 53.6k | void operator()(WebPDecoderConfig* config) const { |
94 | 53.6k | WebPFreeDecBuffer(&config->output); |
95 | 53.6k | } |
96 | | }; |
97 | | |
98 | | // Like WebPPicture but with no C array. |
99 | | // This can be removed once b/294098900 is fixed. |
100 | | struct WebPPictureCpp { |
101 | | inline WebPPictureCpp(int use_argb, WebPEncCSP colorspace, int width, |
102 | | int height, uint8_t* y, uint8_t* u, uint8_t* v, |
103 | | int y_stride, int uv_stride, uint8_t* a, int a_stride, |
104 | | uint32_t* argb, int argb_stride, void* memory, |
105 | 104k | void* memory_argb) { |
106 | 104k | pic.reset(new WebPPicture(), [](WebPPicture* pic) { |
107 | 104k | WebPPictureFree(pic); |
108 | 104k | delete pic; |
109 | 104k | }); |
110 | 104k | if (!WebPPictureInit(pic.get())) assert(false); |
111 | 104k | pic->use_argb = use_argb; |
112 | 104k | pic->colorspace = colorspace; |
113 | 104k | pic->width = width; |
114 | 104k | pic->height = height; |
115 | 104k | pic->y = y; |
116 | 104k | pic->u = u; |
117 | 104k | pic->v = v; |
118 | 104k | pic->a = a; |
119 | 104k | pic->y_stride = y_stride; |
120 | 104k | pic->uv_stride = uv_stride; |
121 | 104k | pic->a_stride = a_stride; |
122 | 104k | pic->argb = argb; |
123 | 104k | pic->argb_stride = argb_stride; |
124 | 104k | pic->memory_ = memory; |
125 | 104k | pic->memory_argb_ = memory_argb; |
126 | 104k | } |
127 | 104k | WebPPicture& ref() const { return const_cast<WebPPicture&>(*pic); } |
128 | | std::shared_ptr<WebPPicture> pic; |
129 | | }; |
130 | | |
131 | 22 | static inline auto ArbitraryWebPPicture() { |
132 | 22 | return fuzztest::FlatMap( |
133 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A. |
134 | 231k | [](int colorspace, int width, int height) { |
135 | 231k | const int uv_width = (int)(((int64_t)width + 1) >> 1); |
136 | 231k | const int uv_height = (int)(((int64_t)height + 1) >> 1); |
137 | | // Create a domain for the vector that strictly obeys w * h * 4. |
138 | 231k | size_t size = width * height; |
139 | 231k | if (colorspace == 0) size *= 4; |
140 | 231k | if (colorspace == 1) size += 2 * uv_width * uv_height; |
141 | 231k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; |
142 | 231k | auto DataDomain = |
143 | 231k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); |
144 | | |
145 | | // Map the vector domain back into our Image struct, injecting w and h |
146 | 231k | return fuzztest::Map( |
147 | 231k | [colorspace, width, |
148 | 231k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { |
149 | 76.6k | WebPPicture pic; |
150 | 76.6k | if (!WebPPictureInit(&pic)) assert(false); |
151 | 76.6k | pic.use_argb = colorspace == 0 ? 1 : 0; |
152 | 76.6k | pic.colorspace = static_cast<WebPEncCSP>( |
153 | 76.6k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); |
154 | 76.6k | pic.width = width; |
155 | 76.6k | pic.height = height; |
156 | 76.6k | if (!WebPPictureAlloc(&pic)) assert(false); |
157 | 76.6k | size_t size = width * height; |
158 | 76.6k | if (pic.use_argb) { |
159 | 9.08k | std::copy(data.begin(), data.begin() + size, |
160 | 9.08k | (uint32_t*)pic.argb); |
161 | 67.6k | } else { |
162 | | // Y. |
163 | 67.6k | auto iter = data.begin(); |
164 | 67.6k | std::copy(iter, iter + size, (uint8_t*)pic.y); |
165 | 67.6k | iter += size; |
166 | | // A. |
167 | 67.6k | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { |
168 | 28.7k | std::copy(iter, iter + size, (uint8_t*)pic.a); |
169 | 28.7k | iter += size; |
170 | 28.7k | } |
171 | | // U and V. |
172 | 67.6k | const int uv_width = (int)(((int64_t)width + 1) >> 1); |
173 | 67.6k | const int uv_height = (int)(((int64_t)height + 1) >> 1); |
174 | 67.6k | size = uv_width * uv_height; |
175 | 67.6k | std::copy(iter, iter + size, (uint8_t*)pic.u); |
176 | 67.6k | iter += size; |
177 | 67.6k | std::copy(iter, iter + size, (uint8_t*)pic.v); |
178 | 67.6k | } |
179 | 76.6k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, |
180 | 76.6k | pic.height, pic.y, pic.u, pic.v, |
181 | 76.6k | pic.y_stride, pic.uv_stride, pic.a, |
182 | 76.6k | pic.a_stride, pic.argb, pic.argb_stride, |
183 | 76.6k | pic.memory_, pic.memory_argb_); |
184 | 76.6k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) const::{lambda(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const&)#1}::operator()(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const) constLine | Count | Source | 148 | 39.5k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 39.5k | WebPPicture pic; | 150 | 39.5k | if (!WebPPictureInit(&pic)) assert(false); | 151 | 39.5k | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 39.5k | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 39.5k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 39.5k | pic.width = width; | 155 | 39.5k | pic.height = height; | 156 | 39.5k | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 39.5k | size_t size = width * height; | 158 | 39.5k | if (pic.use_argb) { | 159 | 4.43k | std::copy(data.begin(), data.begin() + size, | 160 | 4.43k | (uint32_t*)pic.argb); | 161 | 35.0k | } else { | 162 | | // Y. | 163 | 35.0k | auto iter = data.begin(); | 164 | 35.0k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 35.0k | iter += size; | 166 | | // A. | 167 | 35.0k | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 11.5k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 11.5k | iter += size; | 170 | 11.5k | } | 171 | | // U and V. | 172 | 35.0k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 35.0k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 35.0k | size = uv_width * uv_height; | 175 | 35.0k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 35.0k | iter += size; | 177 | 35.0k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 35.0k | } | 179 | 39.5k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 39.5k | pic.height, pic.y, pic.u, pic.v, | 181 | 39.5k | pic.y_stride, pic.uv_stride, pic.a, | 182 | 39.5k | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 39.5k | pic.memory_, pic.memory_argb_); | 184 | 39.5k | }, |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) const::{lambda(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const&)#1}::operator()(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const) constLine | Count | Source | 148 | 23.4k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 23.4k | WebPPicture pic; | 150 | 23.4k | if (!WebPPictureInit(&pic)) assert(false); | 151 | 23.4k | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 23.4k | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 23.4k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 23.4k | pic.width = width; | 155 | 23.4k | pic.height = height; | 156 | 23.4k | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 23.4k | size_t size = width * height; | 158 | 23.4k | if (pic.use_argb) { | 159 | 2.54k | std::copy(data.begin(), data.begin() + size, | 160 | 2.54k | (uint32_t*)pic.argb); | 161 | 20.9k | } else { | 162 | | // Y. | 163 | 20.9k | auto iter = data.begin(); | 164 | 20.9k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 20.9k | iter += size; | 166 | | // A. | 167 | 20.9k | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 12.8k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 12.8k | iter += size; | 170 | 12.8k | } | 171 | | // U and V. | 172 | 20.9k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 20.9k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 20.9k | size = uv_width * uv_height; | 175 | 20.9k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 20.9k | iter += size; | 177 | 20.9k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 20.9k | } | 179 | 23.4k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 23.4k | pic.height, pic.y, pic.u, pic.v, | 181 | 23.4k | pic.y_stride, pic.uv_stride, pic.a, | 182 | 23.4k | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 23.4k | pic.memory_, pic.memory_argb_); | 184 | 23.4k | }, |
enc_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) const::{lambda(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const&)#1}::operator()(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const) constLine | Count | Source | 148 | 13.7k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 13.7k | WebPPicture pic; | 150 | 13.7k | if (!WebPPictureInit(&pic)) assert(false); | 151 | 13.7k | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 13.7k | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 13.7k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 13.7k | pic.width = width; | 155 | 13.7k | pic.height = height; | 156 | 13.7k | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 13.7k | size_t size = width * height; | 158 | 13.7k | if (pic.use_argb) { | 159 | 2.10k | std::copy(data.begin(), data.begin() + size, | 160 | 2.10k | (uint32_t*)pic.argb); | 161 | 11.6k | } else { | 162 | | // Y. | 163 | 11.6k | auto iter = data.begin(); | 164 | 11.6k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 11.6k | iter += size; | 166 | | // A. | 167 | 11.6k | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 4.46k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 4.46k | iter += size; | 170 | 4.46k | } | 171 | | // U and V. | 172 | 11.6k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 11.6k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 11.6k | size = uv_width * uv_height; | 175 | 11.6k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 11.6k | iter += size; | 177 | 11.6k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 11.6k | } | 179 | 13.7k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 13.7k | pic.height, pic.y, pic.u, pic.v, | 181 | 13.7k | pic.y_stride, pic.uv_stride, pic.a, | 182 | 13.7k | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 13.7k | pic.memory_, pic.memory_argb_); | 184 | 13.7k | }, |
|
185 | 231k | DataDomain); |
186 | 231k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) constLine | Count | Source | 134 | 119k | [](int colorspace, int width, int height) { | 135 | 119k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 136 | 119k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 137 | | // Create a domain for the vector that strictly obeys w * h * 4. | 138 | 119k | size_t size = width * height; | 139 | 119k | if (colorspace == 0) size *= 4; | 140 | 119k | if (colorspace == 1) size += 2 * uv_width * uv_height; | 141 | 119k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 142 | 119k | auto DataDomain = | 143 | 119k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 144 | | | 145 | | // Map the vector domain back into our Image struct, injecting w and h | 146 | 119k | return fuzztest::Map( | 147 | 119k | [colorspace, width, | 148 | 119k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 119k | WebPPicture pic; | 150 | 119k | if (!WebPPictureInit(&pic)) assert(false); | 151 | 119k | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 119k | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 119k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 119k | pic.width = width; | 155 | 119k | pic.height = height; | 156 | 119k | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 119k | size_t size = width * height; | 158 | 119k | if (pic.use_argb) { | 159 | 119k | std::copy(data.begin(), data.begin() + size, | 160 | 119k | (uint32_t*)pic.argb); | 161 | 119k | } else { | 162 | | // Y. | 163 | 119k | auto iter = data.begin(); | 164 | 119k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 119k | iter += size; | 166 | | // A. | 167 | 119k | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 119k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 119k | iter += size; | 170 | 119k | } | 171 | | // U and V. | 172 | 119k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 119k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 119k | size = uv_width * uv_height; | 175 | 119k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 119k | iter += size; | 177 | 119k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 119k | } | 179 | 119k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 119k | pic.height, pic.y, pic.u, pic.v, | 181 | 119k | pic.y_stride, pic.uv_stride, pic.a, | 182 | 119k | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 119k | pic.memory_, pic.memory_argb_); | 184 | 119k | }, | 185 | 119k | DataDomain); | 186 | 119k | }, |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) constLine | Count | Source | 134 | 70.6k | [](int colorspace, int width, int height) { | 135 | 70.6k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 136 | 70.6k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 137 | | // Create a domain for the vector that strictly obeys w * h * 4. | 138 | 70.6k | size_t size = width * height; | 139 | 70.6k | if (colorspace == 0) size *= 4; | 140 | 70.6k | if (colorspace == 1) size += 2 * uv_width * uv_height; | 141 | 70.6k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 142 | 70.6k | auto DataDomain = | 143 | 70.6k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 144 | | | 145 | | // Map the vector domain back into our Image struct, injecting w and h | 146 | 70.6k | return fuzztest::Map( | 147 | 70.6k | [colorspace, width, | 148 | 70.6k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 70.6k | WebPPicture pic; | 150 | 70.6k | if (!WebPPictureInit(&pic)) assert(false); | 151 | 70.6k | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 70.6k | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 70.6k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 70.6k | pic.width = width; | 155 | 70.6k | pic.height = height; | 156 | 70.6k | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 70.6k | size_t size = width * height; | 158 | 70.6k | if (pic.use_argb) { | 159 | 70.6k | std::copy(data.begin(), data.begin() + size, | 160 | 70.6k | (uint32_t*)pic.argb); | 161 | 70.6k | } else { | 162 | | // Y. | 163 | 70.6k | auto iter = data.begin(); | 164 | 70.6k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 70.6k | iter += size; | 166 | | // A. | 167 | 70.6k | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 70.6k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 70.6k | iter += size; | 170 | 70.6k | } | 171 | | // U and V. | 172 | 70.6k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 70.6k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 70.6k | size = uv_width * uv_height; | 175 | 70.6k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 70.6k | iter += size; | 177 | 70.6k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 70.6k | } | 179 | 70.6k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 70.6k | pic.height, pic.y, pic.u, pic.v, | 181 | 70.6k | pic.y_stride, pic.uv_stride, pic.a, | 182 | 70.6k | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 70.6k | pic.memory_, pic.memory_argb_); | 184 | 70.6k | }, | 185 | 70.6k | DataDomain); | 186 | 70.6k | }, |
enc_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) constLine | Count | Source | 134 | 41.4k | [](int colorspace, int width, int height) { | 135 | 41.4k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 136 | 41.4k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 137 | | // Create a domain for the vector that strictly obeys w * h * 4. | 138 | 41.4k | size_t size = width * height; | 139 | 41.4k | if (colorspace == 0) size *= 4; | 140 | 41.4k | if (colorspace == 1) size += 2 * uv_width * uv_height; | 141 | 41.4k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 142 | 41.4k | auto DataDomain = | 143 | 41.4k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 144 | | | 145 | | // Map the vector domain back into our Image struct, injecting w and h | 146 | 41.4k | return fuzztest::Map( | 147 | 41.4k | [colorspace, width, | 148 | 41.4k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 41.4k | WebPPicture pic; | 150 | 41.4k | if (!WebPPictureInit(&pic)) assert(false); | 151 | 41.4k | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 41.4k | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 41.4k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 41.4k | pic.width = width; | 155 | 41.4k | pic.height = height; | 156 | 41.4k | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 41.4k | size_t size = width * height; | 158 | 41.4k | if (pic.use_argb) { | 159 | 41.4k | std::copy(data.begin(), data.begin() + size, | 160 | 41.4k | (uint32_t*)pic.argb); | 161 | 41.4k | } else { | 162 | | // Y. | 163 | 41.4k | auto iter = data.begin(); | 164 | 41.4k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 41.4k | iter += size; | 166 | | // A. | 167 | 41.4k | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 41.4k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 41.4k | iter += size; | 170 | 41.4k | } | 171 | | // U and V. | 172 | 41.4k | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 41.4k | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 41.4k | size = uv_width * uv_height; | 175 | 41.4k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 41.4k | iter += size; | 177 | 41.4k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 41.4k | } | 179 | 41.4k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 41.4k | pic.height, pic.y, pic.u, pic.v, | 181 | 41.4k | pic.y_stride, pic.uv_stride, pic.a, | 182 | 41.4k | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 41.4k | pic.memory_, pic.memory_argb_); | 184 | 41.4k | }, | 185 | 41.4k | DataDomain); | 186 | 41.4k | }, |
|
187 | 22 | /*colorspace=*/fuzztest::InRange<int>(0, 2), |
188 | 22 | /*width=*/fuzztest::InRange<int>(1, 128), |
189 | 22 | /*height=*/fuzztest::InRange<int>(1, 128)); |
190 | 22 | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Line | Count | Source | 131 | 16 | static inline auto ArbitraryWebPPicture() { | 132 | 16 | return fuzztest::FlatMap( | 133 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A. | 134 | 16 | [](int colorspace, int width, int height) { | 135 | 16 | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 136 | 16 | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 137 | | // Create a domain for the vector that strictly obeys w * h * 4. | 138 | 16 | size_t size = width * height; | 139 | 16 | if (colorspace == 0) size *= 4; | 140 | 16 | if (colorspace == 1) size += 2 * uv_width * uv_height; | 141 | 16 | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 142 | 16 | auto DataDomain = | 143 | 16 | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 144 | | | 145 | | // Map the vector domain back into our Image struct, injecting w and h | 146 | 16 | return fuzztest::Map( | 147 | 16 | [colorspace, width, | 148 | 16 | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 16 | WebPPicture pic; | 150 | 16 | if (!WebPPictureInit(&pic)) assert(false); | 151 | 16 | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 16 | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 16 | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 16 | pic.width = width; | 155 | 16 | pic.height = height; | 156 | 16 | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 16 | size_t size = width * height; | 158 | 16 | if (pic.use_argb) { | 159 | 16 | std::copy(data.begin(), data.begin() + size, | 160 | 16 | (uint32_t*)pic.argb); | 161 | 16 | } else { | 162 | | // Y. | 163 | 16 | auto iter = data.begin(); | 164 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 16 | iter += size; | 166 | | // A. | 167 | 16 | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 16 | iter += size; | 170 | 16 | } | 171 | | // U and V. | 172 | 16 | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 16 | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 16 | size = uv_width * uv_height; | 175 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 16 | iter += size; | 177 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 16 | } | 179 | 16 | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 16 | pic.height, pic.y, pic.u, pic.v, | 181 | 16 | pic.y_stride, pic.uv_stride, pic.a, | 182 | 16 | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 16 | pic.memory_, pic.memory_argb_); | 184 | 16 | }, | 185 | 16 | DataDomain); | 186 | 16 | }, | 187 | 16 | /*colorspace=*/fuzztest::InRange<int>(0, 2), | 188 | 16 | /*width=*/fuzztest::InRange<int>(1, 128), | 189 | 16 | /*height=*/fuzztest::InRange<int>(1, 128)); | 190 | 16 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Line | Count | Source | 131 | 4 | static inline auto ArbitraryWebPPicture() { | 132 | 4 | return fuzztest::FlatMap( | 133 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A. | 134 | 4 | [](int colorspace, int width, int height) { | 135 | 4 | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 136 | 4 | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 137 | | // Create a domain for the vector that strictly obeys w * h * 4. | 138 | 4 | size_t size = width * height; | 139 | 4 | if (colorspace == 0) size *= 4; | 140 | 4 | if (colorspace == 1) size += 2 * uv_width * uv_height; | 141 | 4 | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 142 | 4 | auto DataDomain = | 143 | 4 | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 144 | | | 145 | | // Map the vector domain back into our Image struct, injecting w and h | 146 | 4 | return fuzztest::Map( | 147 | 4 | [colorspace, width, | 148 | 4 | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 4 | WebPPicture pic; | 150 | 4 | if (!WebPPictureInit(&pic)) assert(false); | 151 | 4 | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 4 | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 4 | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 4 | pic.width = width; | 155 | 4 | pic.height = height; | 156 | 4 | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 4 | size_t size = width * height; | 158 | 4 | if (pic.use_argb) { | 159 | 4 | std::copy(data.begin(), data.begin() + size, | 160 | 4 | (uint32_t*)pic.argb); | 161 | 4 | } else { | 162 | | // Y. | 163 | 4 | auto iter = data.begin(); | 164 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 4 | iter += size; | 166 | | // A. | 167 | 4 | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 4 | iter += size; | 170 | 4 | } | 171 | | // U and V. | 172 | 4 | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 4 | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 4 | size = uv_width * uv_height; | 175 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 4 | iter += size; | 177 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 4 | } | 179 | 4 | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 4 | pic.height, pic.y, pic.u, pic.v, | 181 | 4 | pic.y_stride, pic.uv_stride, pic.a, | 182 | 4 | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 4 | pic.memory_, pic.memory_argb_); | 184 | 4 | }, | 185 | 4 | DataDomain); | 186 | 4 | }, | 187 | 4 | /*colorspace=*/fuzztest::InRange<int>(0, 2), | 188 | 4 | /*width=*/fuzztest::InRange<int>(1, 128), | 189 | 4 | /*height=*/fuzztest::InRange<int>(1, 128)); | 190 | 4 | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() enc_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Line | Count | Source | 131 | 2 | static inline auto ArbitraryWebPPicture() { | 132 | 2 | return fuzztest::FlatMap( | 133 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A. | 134 | 2 | [](int colorspace, int width, int height) { | 135 | 2 | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 136 | 2 | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 137 | | // Create a domain for the vector that strictly obeys w * h * 4. | 138 | 2 | size_t size = width * height; | 139 | 2 | if (colorspace == 0) size *= 4; | 140 | 2 | if (colorspace == 1) size += 2 * uv_width * uv_height; | 141 | 2 | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 142 | 2 | auto DataDomain = | 143 | 2 | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 144 | | | 145 | | // Map the vector domain back into our Image struct, injecting w and h | 146 | 2 | return fuzztest::Map( | 147 | 2 | [colorspace, width, | 148 | 2 | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 149 | 2 | WebPPicture pic; | 150 | 2 | if (!WebPPictureInit(&pic)) assert(false); | 151 | 2 | pic.use_argb = colorspace == 0 ? 1 : 0; | 152 | 2 | pic.colorspace = static_cast<WebPEncCSP>( | 153 | 2 | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 154 | 2 | pic.width = width; | 155 | 2 | pic.height = height; | 156 | 2 | if (!WebPPictureAlloc(&pic)) assert(false); | 157 | 2 | size_t size = width * height; | 158 | 2 | if (pic.use_argb) { | 159 | 2 | std::copy(data.begin(), data.begin() + size, | 160 | 2 | (uint32_t*)pic.argb); | 161 | 2 | } else { | 162 | | // Y. | 163 | 2 | auto iter = data.begin(); | 164 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.y); | 165 | 2 | iter += size; | 166 | | // A. | 167 | 2 | if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 168 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.a); | 169 | 2 | iter += size; | 170 | 2 | } | 171 | | // U and V. | 172 | 2 | const int uv_width = (int)(((int64_t)width + 1) >> 1); | 173 | 2 | const int uv_height = (int)(((int64_t)height + 1) >> 1); | 174 | 2 | size = uv_width * uv_height; | 175 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.u); | 176 | 2 | iter += size; | 177 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.v); | 178 | 2 | } | 179 | 2 | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 180 | 2 | pic.height, pic.y, pic.u, pic.v, | 181 | 2 | pic.y_stride, pic.uv_stride, pic.a, | 182 | 2 | pic.a_stride, pic.argb, pic.argb_stride, | 183 | 2 | pic.memory_, pic.memory_argb_); | 184 | 2 | }, | 185 | 2 | DataDomain); | 186 | 2 | }, | 187 | 2 | /*colorspace=*/fuzztest::InRange<int>(0, 2), | 188 | 2 | /*width=*/fuzztest::InRange<int>(1, 128), | 189 | 2 | /*height=*/fuzztest::InRange<int>(1, 128)); | 190 | 2 | } |
Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: advanced_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() |
191 | | |
192 | 20 | static inline auto ArbitraryWebPPictureFromIndex() { |
193 | 20 | return fuzztest::Map( |
194 | 27.7k | [](int index, bool use_argb) -> WebPPictureCpp { |
195 | | // Map the vector domain back into our Image struct, injecting w and h |
196 | 27.7k | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); |
197 | 27.7k | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, |
198 | 27.7k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, |
199 | 27.7k | pic.a, pic.a_stride, pic.argb, pic.argb_stride, |
200 | 27.7k | pic.memory_, pic.memory_argb_); |
201 | 27.7k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex()::{lambda(int, bool)#1}::operator()(int, bool) constLine | Count | Source | 194 | 14.1k | [](int index, bool use_argb) -> WebPPictureCpp { | 195 | | // Map the vector domain back into our Image struct, injecting w and h | 196 | 14.1k | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 197 | 14.1k | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 198 | 14.1k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 199 | 14.1k | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 200 | 14.1k | pic.memory_, pic.memory_argb_); | 201 | 14.1k | }, |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex()::{lambda(int, bool)#1}::operator()(int, bool) constLine | Count | Source | 194 | 13.5k | [](int index, bool use_argb) -> WebPPictureCpp { | 195 | | // Map the vector domain back into our Image struct, injecting w and h | 196 | 13.5k | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 197 | 13.5k | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 198 | 13.5k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 199 | 13.5k | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 200 | 13.5k | pic.memory_, pic.memory_argb_); | 201 | 13.5k | }, |
|
202 | 20 | /*index=*/fuzztest::InRange<int>(0, fuzz_utils::kNumSourceImages - 1), |
203 | 20 | /*use_argb=*/fuzztest::Arbitrary<bool>()); |
204 | 20 | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Line | Count | Source | 192 | 16 | static inline auto ArbitraryWebPPictureFromIndex() { | 193 | 16 | return fuzztest::Map( | 194 | 16 | [](int index, bool use_argb) -> WebPPictureCpp { | 195 | | // Map the vector domain back into our Image struct, injecting w and h | 196 | 16 | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 197 | 16 | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 198 | 16 | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 199 | 16 | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 200 | 16 | pic.memory_, pic.memory_argb_); | 201 | 16 | }, | 202 | 16 | /*index=*/fuzztest::InRange<int>(0, fuzz_utils::kNumSourceImages - 1), | 203 | 16 | /*use_argb=*/fuzztest::Arbitrary<bool>()); | 204 | 16 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Line | Count | Source | 192 | 4 | static inline auto ArbitraryWebPPictureFromIndex() { | 193 | 4 | return fuzztest::Map( | 194 | 4 | [](int index, bool use_argb) -> WebPPictureCpp { | 195 | | // Map the vector domain back into our Image struct, injecting w and h | 196 | 4 | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 197 | 4 | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 198 | 4 | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 199 | 4 | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 200 | 4 | pic.memory_, pic.memory_argb_); | 201 | 4 | }, | 202 | 4 | /*index=*/fuzztest::InRange<int>(0, fuzz_utils::kNumSourceImages - 1), | 203 | 4 | /*use_argb=*/fuzztest::Arbitrary<bool>()); | 204 | 4 | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: enc_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: advanced_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() |
205 | | |
206 | 42 | static inline auto ArbitraryWebPConfig() { |
207 | 42 | return fuzztest::Map( |
208 | 42 | [](int lossless, int quality, int method, int image_hint, int segments, |
209 | 42 | int sns_strength, int filter_strength, int filter_sharpness, |
210 | 42 | int filter_type, int autofilter, int alpha_compression, |
211 | 42 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, |
212 | 42 | int partitions, int partition_limit, int emulate_jpeg_size, |
213 | 42 | int thread_level, int low_memory, int near_lossless, int exact, |
214 | 104k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { |
215 | 104k | WebPConfig config; |
216 | 104k | if (!WebPConfigInit(&config)) assert(false); |
217 | 104k | config.lossless = lossless; |
218 | 104k | config.quality = quality; |
219 | 104k | config.method = method; |
220 | 104k | config.image_hint = (WebPImageHint)image_hint; |
221 | 104k | config.segments = segments; |
222 | 104k | config.sns_strength = sns_strength; |
223 | 104k | config.filter_strength = filter_strength; |
224 | 104k | config.filter_sharpness = filter_sharpness; |
225 | 104k | config.filter_type = filter_type; |
226 | 104k | config.autofilter = autofilter; |
227 | 104k | config.alpha_compression = alpha_compression; |
228 | 104k | config.alpha_filtering = alpha_filtering; |
229 | 104k | config.alpha_quality = alpha_quality; |
230 | 104k | config.pass = pass; |
231 | 104k | config.show_compressed = 1; |
232 | 104k | config.preprocessing = preprocessing; |
233 | 104k | config.partitions = partitions; |
234 | 104k | config.partition_limit = 10 * partition_limit; |
235 | 104k | config.emulate_jpeg_size = emulate_jpeg_size; |
236 | 104k | config.thread_level = thread_level; |
237 | 104k | config.low_memory = low_memory; |
238 | 104k | config.near_lossless = 20 * near_lossless; |
239 | 104k | config.exact = exact; |
240 | 104k | config.use_delta_palette = use_delta_palette; |
241 | 104k | config.use_sharp_yuv = use_sharp_yuv; |
242 | 104k | if (!WebPValidateConfig(&config)) assert(false); |
243 | 104k | return config; |
244 | 104k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig()::{lambda(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)#1}::operator()(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) constLine | Count | Source | 214 | 53.6k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 215 | 53.6k | WebPConfig config; | 216 | 53.6k | if (!WebPConfigInit(&config)) assert(false); | 217 | 53.6k | config.lossless = lossless; | 218 | 53.6k | config.quality = quality; | 219 | 53.6k | config.method = method; | 220 | 53.6k | config.image_hint = (WebPImageHint)image_hint; | 221 | 53.6k | config.segments = segments; | 222 | 53.6k | config.sns_strength = sns_strength; | 223 | 53.6k | config.filter_strength = filter_strength; | 224 | 53.6k | config.filter_sharpness = filter_sharpness; | 225 | 53.6k | config.filter_type = filter_type; | 226 | 53.6k | config.autofilter = autofilter; | 227 | 53.6k | config.alpha_compression = alpha_compression; | 228 | 53.6k | config.alpha_filtering = alpha_filtering; | 229 | 53.6k | config.alpha_quality = alpha_quality; | 230 | 53.6k | config.pass = pass; | 231 | 53.6k | config.show_compressed = 1; | 232 | 53.6k | config.preprocessing = preprocessing; | 233 | 53.6k | config.partitions = partitions; | 234 | 53.6k | config.partition_limit = 10 * partition_limit; | 235 | 53.6k | config.emulate_jpeg_size = emulate_jpeg_size; | 236 | 53.6k | config.thread_level = thread_level; | 237 | 53.6k | config.low_memory = low_memory; | 238 | 53.6k | config.near_lossless = 20 * near_lossless; | 239 | 53.6k | config.exact = exact; | 240 | 53.6k | config.use_delta_palette = use_delta_palette; | 241 | 53.6k | config.use_sharp_yuv = use_sharp_yuv; | 242 | 53.6k | if (!WebPValidateConfig(&config)) assert(false); | 243 | 53.6k | return config; | 244 | 53.6k | }, |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig()::{lambda(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)#1}::operator()(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) constLine | Count | Source | 214 | 37.0k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 215 | 37.0k | WebPConfig config; | 216 | 37.0k | if (!WebPConfigInit(&config)) assert(false); | 217 | 37.0k | config.lossless = lossless; | 218 | 37.0k | config.quality = quality; | 219 | 37.0k | config.method = method; | 220 | 37.0k | config.image_hint = (WebPImageHint)image_hint; | 221 | 37.0k | config.segments = segments; | 222 | 37.0k | config.sns_strength = sns_strength; | 223 | 37.0k | config.filter_strength = filter_strength; | 224 | 37.0k | config.filter_sharpness = filter_sharpness; | 225 | 37.0k | config.filter_type = filter_type; | 226 | 37.0k | config.autofilter = autofilter; | 227 | 37.0k | config.alpha_compression = alpha_compression; | 228 | 37.0k | config.alpha_filtering = alpha_filtering; | 229 | 37.0k | config.alpha_quality = alpha_quality; | 230 | 37.0k | config.pass = pass; | 231 | 37.0k | config.show_compressed = 1; | 232 | 37.0k | config.preprocessing = preprocessing; | 233 | 37.0k | config.partitions = partitions; | 234 | 37.0k | config.partition_limit = 10 * partition_limit; | 235 | 37.0k | config.emulate_jpeg_size = emulate_jpeg_size; | 236 | 37.0k | config.thread_level = thread_level; | 237 | 37.0k | config.low_memory = low_memory; | 238 | 37.0k | config.near_lossless = 20 * near_lossless; | 239 | 37.0k | config.exact = exact; | 240 | 37.0k | config.use_delta_palette = use_delta_palette; | 241 | 37.0k | config.use_sharp_yuv = use_sharp_yuv; | 242 | 37.0k | if (!WebPValidateConfig(&config)) assert(false); | 243 | 37.0k | return config; | 244 | 37.0k | }, |
enc_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig()::{lambda(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)#1}::operator()(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) constLine | Count | Source | 214 | 13.7k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 215 | 13.7k | WebPConfig config; | 216 | 13.7k | if (!WebPConfigInit(&config)) assert(false); | 217 | 13.7k | config.lossless = lossless; | 218 | 13.7k | config.quality = quality; | 219 | 13.7k | config.method = method; | 220 | 13.7k | config.image_hint = (WebPImageHint)image_hint; | 221 | 13.7k | config.segments = segments; | 222 | 13.7k | config.sns_strength = sns_strength; | 223 | 13.7k | config.filter_strength = filter_strength; | 224 | 13.7k | config.filter_sharpness = filter_sharpness; | 225 | 13.7k | config.filter_type = filter_type; | 226 | 13.7k | config.autofilter = autofilter; | 227 | 13.7k | config.alpha_compression = alpha_compression; | 228 | 13.7k | config.alpha_filtering = alpha_filtering; | 229 | 13.7k | config.alpha_quality = alpha_quality; | 230 | 13.7k | config.pass = pass; | 231 | 13.7k | config.show_compressed = 1; | 232 | 13.7k | config.preprocessing = preprocessing; | 233 | 13.7k | config.partitions = partitions; | 234 | 13.7k | config.partition_limit = 10 * partition_limit; | 235 | 13.7k | config.emulate_jpeg_size = emulate_jpeg_size; | 236 | 13.7k | config.thread_level = thread_level; | 237 | 13.7k | config.low_memory = low_memory; | 238 | 13.7k | config.near_lossless = 20 * near_lossless; | 239 | 13.7k | config.exact = exact; | 240 | 13.7k | config.use_delta_palette = use_delta_palette; | 241 | 13.7k | config.use_sharp_yuv = use_sharp_yuv; | 242 | 13.7k | if (!WebPValidateConfig(&config)) assert(false); | 243 | 13.7k | return config; | 244 | 13.7k | }, |
|
245 | 42 | /*lossless=*/fuzztest::InRange<int>(0, 1), |
246 | 42 | /*quality=*/fuzztest::InRange<int>(0, 100), |
247 | 42 | /*method=*/fuzztest::InRange<int>(0, 6), |
248 | 42 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), |
249 | 42 | /*segments=*/fuzztest::InRange<int>(1, 4), |
250 | 42 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), |
251 | 42 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), |
252 | 42 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), |
253 | 42 | /*filter_type=*/fuzztest::InRange<int>(0, 1), |
254 | 42 | /*autofilter=*/fuzztest::InRange<int>(0, 1), |
255 | 42 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), |
256 | 42 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), |
257 | 42 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), |
258 | 42 | /*pass=*/fuzztest::InRange<int>(1, 10), |
259 | 42 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), |
260 | 42 | /*partitions=*/fuzztest::InRange<int>(0, 3), |
261 | 42 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), |
262 | 42 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), |
263 | 42 | /*thread_level=*/fuzztest::InRange<int>(0, 1), |
264 | 42 | /*low_memory=*/fuzztest::InRange<int>(0, 1), |
265 | 42 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), |
266 | 42 | /*exact=*/fuzztest::InRange<int>(0, 1), |
267 | 42 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), |
268 | 42 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); |
269 | 42 | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Line | Count | Source | 206 | 32 | static inline auto ArbitraryWebPConfig() { | 207 | 32 | return fuzztest::Map( | 208 | 32 | [](int lossless, int quality, int method, int image_hint, int segments, | 209 | 32 | int sns_strength, int filter_strength, int filter_sharpness, | 210 | 32 | int filter_type, int autofilter, int alpha_compression, | 211 | 32 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, | 212 | 32 | int partitions, int partition_limit, int emulate_jpeg_size, | 213 | 32 | int thread_level, int low_memory, int near_lossless, int exact, | 214 | 32 | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 215 | 32 | WebPConfig config; | 216 | 32 | if (!WebPConfigInit(&config)) assert(false); | 217 | 32 | config.lossless = lossless; | 218 | 32 | config.quality = quality; | 219 | 32 | config.method = method; | 220 | 32 | config.image_hint = (WebPImageHint)image_hint; | 221 | 32 | config.segments = segments; | 222 | 32 | config.sns_strength = sns_strength; | 223 | 32 | config.filter_strength = filter_strength; | 224 | 32 | config.filter_sharpness = filter_sharpness; | 225 | 32 | config.filter_type = filter_type; | 226 | 32 | config.autofilter = autofilter; | 227 | 32 | config.alpha_compression = alpha_compression; | 228 | 32 | config.alpha_filtering = alpha_filtering; | 229 | 32 | config.alpha_quality = alpha_quality; | 230 | 32 | config.pass = pass; | 231 | 32 | config.show_compressed = 1; | 232 | 32 | config.preprocessing = preprocessing; | 233 | 32 | config.partitions = partitions; | 234 | 32 | config.partition_limit = 10 * partition_limit; | 235 | 32 | config.emulate_jpeg_size = emulate_jpeg_size; | 236 | 32 | config.thread_level = thread_level; | 237 | 32 | config.low_memory = low_memory; | 238 | 32 | config.near_lossless = 20 * near_lossless; | 239 | 32 | config.exact = exact; | 240 | 32 | config.use_delta_palette = use_delta_palette; | 241 | 32 | config.use_sharp_yuv = use_sharp_yuv; | 242 | 32 | if (!WebPValidateConfig(&config)) assert(false); | 243 | 32 | return config; | 244 | 32 | }, | 245 | 32 | /*lossless=*/fuzztest::InRange<int>(0, 1), | 246 | 32 | /*quality=*/fuzztest::InRange<int>(0, 100), | 247 | 32 | /*method=*/fuzztest::InRange<int>(0, 6), | 248 | 32 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), | 249 | 32 | /*segments=*/fuzztest::InRange<int>(1, 4), | 250 | 32 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), | 251 | 32 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), | 252 | 32 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), | 253 | 32 | /*filter_type=*/fuzztest::InRange<int>(0, 1), | 254 | 32 | /*autofilter=*/fuzztest::InRange<int>(0, 1), | 255 | 32 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), | 256 | 32 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), | 257 | 32 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), | 258 | 32 | /*pass=*/fuzztest::InRange<int>(1, 10), | 259 | 32 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), | 260 | 32 | /*partitions=*/fuzztest::InRange<int>(0, 3), | 261 | 32 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), | 262 | 32 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), | 263 | 32 | /*thread_level=*/fuzztest::InRange<int>(0, 1), | 264 | 32 | /*low_memory=*/fuzztest::InRange<int>(0, 1), | 265 | 32 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), | 266 | 32 | /*exact=*/fuzztest::InRange<int>(0, 1), | 267 | 32 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), | 268 | 32 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); | 269 | 32 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Line | Count | Source | 206 | 8 | static inline auto ArbitraryWebPConfig() { | 207 | 8 | return fuzztest::Map( | 208 | 8 | [](int lossless, int quality, int method, int image_hint, int segments, | 209 | 8 | int sns_strength, int filter_strength, int filter_sharpness, | 210 | 8 | int filter_type, int autofilter, int alpha_compression, | 211 | 8 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, | 212 | 8 | int partitions, int partition_limit, int emulate_jpeg_size, | 213 | 8 | int thread_level, int low_memory, int near_lossless, int exact, | 214 | 8 | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 215 | 8 | WebPConfig config; | 216 | 8 | if (!WebPConfigInit(&config)) assert(false); | 217 | 8 | config.lossless = lossless; | 218 | 8 | config.quality = quality; | 219 | 8 | config.method = method; | 220 | 8 | config.image_hint = (WebPImageHint)image_hint; | 221 | 8 | config.segments = segments; | 222 | 8 | config.sns_strength = sns_strength; | 223 | 8 | config.filter_strength = filter_strength; | 224 | 8 | config.filter_sharpness = filter_sharpness; | 225 | 8 | config.filter_type = filter_type; | 226 | 8 | config.autofilter = autofilter; | 227 | 8 | config.alpha_compression = alpha_compression; | 228 | 8 | config.alpha_filtering = alpha_filtering; | 229 | 8 | config.alpha_quality = alpha_quality; | 230 | 8 | config.pass = pass; | 231 | 8 | config.show_compressed = 1; | 232 | 8 | config.preprocessing = preprocessing; | 233 | 8 | config.partitions = partitions; | 234 | 8 | config.partition_limit = 10 * partition_limit; | 235 | 8 | config.emulate_jpeg_size = emulate_jpeg_size; | 236 | 8 | config.thread_level = thread_level; | 237 | 8 | config.low_memory = low_memory; | 238 | 8 | config.near_lossless = 20 * near_lossless; | 239 | 8 | config.exact = exact; | 240 | 8 | config.use_delta_palette = use_delta_palette; | 241 | 8 | config.use_sharp_yuv = use_sharp_yuv; | 242 | 8 | if (!WebPValidateConfig(&config)) assert(false); | 243 | 8 | return config; | 244 | 8 | }, | 245 | 8 | /*lossless=*/fuzztest::InRange<int>(0, 1), | 246 | 8 | /*quality=*/fuzztest::InRange<int>(0, 100), | 247 | 8 | /*method=*/fuzztest::InRange<int>(0, 6), | 248 | 8 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), | 249 | 8 | /*segments=*/fuzztest::InRange<int>(1, 4), | 250 | 8 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), | 251 | 8 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), | 252 | 8 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), | 253 | 8 | /*filter_type=*/fuzztest::InRange<int>(0, 1), | 254 | 8 | /*autofilter=*/fuzztest::InRange<int>(0, 1), | 255 | 8 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), | 256 | 8 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), | 257 | 8 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), | 258 | 8 | /*pass=*/fuzztest::InRange<int>(1, 10), | 259 | 8 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), | 260 | 8 | /*partitions=*/fuzztest::InRange<int>(0, 3), | 261 | 8 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), | 262 | 8 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), | 263 | 8 | /*thread_level=*/fuzztest::InRange<int>(0, 1), | 264 | 8 | /*low_memory=*/fuzztest::InRange<int>(0, 1), | 265 | 8 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), | 266 | 8 | /*exact=*/fuzztest::InRange<int>(0, 1), | 267 | 8 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), | 268 | 8 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); | 269 | 8 | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() enc_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Line | Count | Source | 206 | 2 | static inline auto ArbitraryWebPConfig() { | 207 | 2 | return fuzztest::Map( | 208 | 2 | [](int lossless, int quality, int method, int image_hint, int segments, | 209 | 2 | int sns_strength, int filter_strength, int filter_sharpness, | 210 | 2 | int filter_type, int autofilter, int alpha_compression, | 211 | 2 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, | 212 | 2 | int partitions, int partition_limit, int emulate_jpeg_size, | 213 | 2 | int thread_level, int low_memory, int near_lossless, int exact, | 214 | 2 | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 215 | 2 | WebPConfig config; | 216 | 2 | if (!WebPConfigInit(&config)) assert(false); | 217 | 2 | config.lossless = lossless; | 218 | 2 | config.quality = quality; | 219 | 2 | config.method = method; | 220 | 2 | config.image_hint = (WebPImageHint)image_hint; | 221 | 2 | config.segments = segments; | 222 | 2 | config.sns_strength = sns_strength; | 223 | 2 | config.filter_strength = filter_strength; | 224 | 2 | config.filter_sharpness = filter_sharpness; | 225 | 2 | config.filter_type = filter_type; | 226 | 2 | config.autofilter = autofilter; | 227 | 2 | config.alpha_compression = alpha_compression; | 228 | 2 | config.alpha_filtering = alpha_filtering; | 229 | 2 | config.alpha_quality = alpha_quality; | 230 | 2 | config.pass = pass; | 231 | 2 | config.show_compressed = 1; | 232 | 2 | config.preprocessing = preprocessing; | 233 | 2 | config.partitions = partitions; | 234 | 2 | config.partition_limit = 10 * partition_limit; | 235 | 2 | config.emulate_jpeg_size = emulate_jpeg_size; | 236 | 2 | config.thread_level = thread_level; | 237 | 2 | config.low_memory = low_memory; | 238 | 2 | config.near_lossless = 20 * near_lossless; | 239 | 2 | config.exact = exact; | 240 | 2 | config.use_delta_palette = use_delta_palette; | 241 | 2 | config.use_sharp_yuv = use_sharp_yuv; | 242 | 2 | if (!WebPValidateConfig(&config)) assert(false); | 243 | 2 | return config; | 244 | 2 | }, | 245 | 2 | /*lossless=*/fuzztest::InRange<int>(0, 1), | 246 | 2 | /*quality=*/fuzztest::InRange<int>(0, 100), | 247 | 2 | /*method=*/fuzztest::InRange<int>(0, 6), | 248 | 2 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), | 249 | 2 | /*segments=*/fuzztest::InRange<int>(1, 4), | 250 | 2 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), | 251 | 2 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), | 252 | 2 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), | 253 | 2 | /*filter_type=*/fuzztest::InRange<int>(0, 1), | 254 | 2 | /*autofilter=*/fuzztest::InRange<int>(0, 1), | 255 | 2 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), | 256 | 2 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), | 257 | 2 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), | 258 | 2 | /*pass=*/fuzztest::InRange<int>(1, 10), | 259 | 2 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), | 260 | 2 | /*partitions=*/fuzztest::InRange<int>(0, 3), | 261 | 2 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), | 262 | 2 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), | 263 | 2 | /*thread_level=*/fuzztest::InRange<int>(0, 1), | 264 | 2 | /*low_memory=*/fuzztest::InRange<int>(0, 1), | 265 | 2 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), | 266 | 2 | /*exact=*/fuzztest::InRange<int>(0, 1), | 267 | 2 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), | 268 | 2 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); | 269 | 2 | } |
Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: dec_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: advanced_api_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() |
270 | | |
271 | | // Like WebPDecoderOptions but with no C array. |
272 | | // This can be removed once b/294098900 is fixed. |
273 | | struct WebPDecoderOptionsCpp { |
274 | | int bypass_filtering; |
275 | | int no_fancy_upsampling; |
276 | | int use_cropping; |
277 | | int crop_left, crop_top; |
278 | | |
279 | | int crop_width, crop_height; |
280 | | int use_scaling; |
281 | | int scaled_width, scaled_height; |
282 | | |
283 | | int use_threads; |
284 | | int dithering_strength; |
285 | | int flip; |
286 | | int alpha_dithering_strength; |
287 | | |
288 | | std::array<uint32_t, 5> pad; |
289 | | }; |
290 | | |
291 | 22 | static inline auto ArbitraryValidWebPDecoderOptions() { |
292 | 22 | return fuzztest::Map( |
293 | 22 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, |
294 | 22 | int crop_left, int crop_top, int crop_width, int crop_height, |
295 | 22 | int use_scaling, int scaled_width, int scaled_height, int use_threads, |
296 | 22 | int dithering_strength, int flip, |
297 | 40.1k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { |
298 | 40.1k | WebPDecoderOptions options; |
299 | 40.1k | options.bypass_filtering = bypass_filtering; |
300 | 40.1k | options.no_fancy_upsampling = no_fancy_upsampling; |
301 | 40.1k | options.use_cropping = use_cropping; |
302 | 40.1k | options.crop_left = crop_left; |
303 | 40.1k | options.crop_top = crop_top; |
304 | 40.1k | options.crop_width = crop_width; |
305 | 40.1k | options.crop_height = crop_height; |
306 | 40.1k | options.use_scaling = use_scaling; |
307 | 40.1k | options.scaled_width = scaled_width; |
308 | 40.1k | options.scaled_height = scaled_height; |
309 | 40.1k | options.use_threads = use_threads; |
310 | 40.1k | options.dithering_strength = dithering_strength; |
311 | 40.1k | options.flip = flip; |
312 | 40.1k | options.alpha_dithering_strength = alpha_dithering_strength; |
313 | 40.1k | WebPDecoderConfig config; |
314 | 40.1k | if (!WebPInitDecoderConfig(&config)) assert(false); |
315 | 40.1k | config.options = options; |
316 | 40.1k | if (!WebPValidateDecoderConfig(&config)) assert(false); |
317 | 40.1k | WebPDecoderOptionsCpp options_cpp; |
318 | 40.1k | std::memcpy(&options_cpp, &options, sizeof(options)); |
319 | 40.1k | return options_cpp; |
320 | 40.1k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions()::{lambda(int, int, int, int, int, int, int, int, int, int, int, int, int, int)#1}::operator()(int, int, int, int, int, int, int, int, int, int, int, int, int, int) constLine | Count | Source | 297 | 25.8k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 298 | 25.8k | WebPDecoderOptions options; | 299 | 25.8k | options.bypass_filtering = bypass_filtering; | 300 | 25.8k | options.no_fancy_upsampling = no_fancy_upsampling; | 301 | 25.8k | options.use_cropping = use_cropping; | 302 | 25.8k | options.crop_left = crop_left; | 303 | 25.8k | options.crop_top = crop_top; | 304 | 25.8k | options.crop_width = crop_width; | 305 | 25.8k | options.crop_height = crop_height; | 306 | 25.8k | options.use_scaling = use_scaling; | 307 | 25.8k | options.scaled_width = scaled_width; | 308 | 25.8k | options.scaled_height = scaled_height; | 309 | 25.8k | options.use_threads = use_threads; | 310 | 25.8k | options.dithering_strength = dithering_strength; | 311 | 25.8k | options.flip = flip; | 312 | 25.8k | options.alpha_dithering_strength = alpha_dithering_strength; | 313 | 25.8k | WebPDecoderConfig config; | 314 | 25.8k | if (!WebPInitDecoderConfig(&config)) assert(false); | 315 | 25.8k | config.options = options; | 316 | 25.8k | if (!WebPValidateDecoderConfig(&config)) assert(false); | 317 | 25.8k | WebPDecoderOptionsCpp options_cpp; | 318 | 25.8k | std::memcpy(&options_cpp, &options, sizeof(options)); | 319 | 25.8k | return options_cpp; | 320 | 25.8k | }, |
dec_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions()::{lambda(int, int, int, int, int, int, int, int, int, int, int, int, int, int)#1}::operator()(int, int, int, int, int, int, int, int, int, int, int, int, int, int) constLine | Count | Source | 297 | 5.86k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 298 | 5.86k | WebPDecoderOptions options; | 299 | 5.86k | options.bypass_filtering = bypass_filtering; | 300 | 5.86k | options.no_fancy_upsampling = no_fancy_upsampling; | 301 | 5.86k | options.use_cropping = use_cropping; | 302 | 5.86k | options.crop_left = crop_left; | 303 | 5.86k | options.crop_top = crop_top; | 304 | 5.86k | options.crop_width = crop_width; | 305 | 5.86k | options.crop_height = crop_height; | 306 | 5.86k | options.use_scaling = use_scaling; | 307 | 5.86k | options.scaled_width = scaled_width; | 308 | 5.86k | options.scaled_height = scaled_height; | 309 | 5.86k | options.use_threads = use_threads; | 310 | 5.86k | options.dithering_strength = dithering_strength; | 311 | 5.86k | options.flip = flip; | 312 | 5.86k | options.alpha_dithering_strength = alpha_dithering_strength; | 313 | 5.86k | WebPDecoderConfig config; | 314 | 5.86k | if (!WebPInitDecoderConfig(&config)) assert(false); | 315 | 5.86k | config.options = options; | 316 | 5.86k | if (!WebPValidateDecoderConfig(&config)) assert(false); | 317 | 5.86k | WebPDecoderOptionsCpp options_cpp; | 318 | 5.86k | std::memcpy(&options_cpp, &options, sizeof(options)); | 319 | 5.86k | return options_cpp; | 320 | 5.86k | }, |
advanced_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions()::{lambda(int, int, int, int, int, int, int, int, int, int, int, int, int, int)#1}::operator()(int, int, int, int, int, int, int, int, int, int, int, int, int, int) constLine | Count | Source | 297 | 8.35k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 298 | 8.35k | WebPDecoderOptions options; | 299 | 8.35k | options.bypass_filtering = bypass_filtering; | 300 | 8.35k | options.no_fancy_upsampling = no_fancy_upsampling; | 301 | 8.35k | options.use_cropping = use_cropping; | 302 | 8.35k | options.crop_left = crop_left; | 303 | 8.35k | options.crop_top = crop_top; | 304 | 8.35k | options.crop_width = crop_width; | 305 | 8.35k | options.crop_height = crop_height; | 306 | 8.35k | options.use_scaling = use_scaling; | 307 | 8.35k | options.scaled_width = scaled_width; | 308 | 8.35k | options.scaled_height = scaled_height; | 309 | 8.35k | options.use_threads = use_threads; | 310 | 8.35k | options.dithering_strength = dithering_strength; | 311 | 8.35k | options.flip = flip; | 312 | 8.35k | options.alpha_dithering_strength = alpha_dithering_strength; | 313 | 8.35k | WebPDecoderConfig config; | 314 | 8.35k | if (!WebPInitDecoderConfig(&config)) assert(false); | 315 | 8.35k | config.options = options; | 316 | 8.35k | if (!WebPValidateDecoderConfig(&config)) assert(false); | 317 | 8.35k | WebPDecoderOptionsCpp options_cpp; | 318 | 8.35k | std::memcpy(&options_cpp, &options, sizeof(options)); | 319 | 8.35k | return options_cpp; | 320 | 8.35k | }, |
|
321 | 22 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), |
322 | 22 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), |
323 | 22 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), |
324 | 22 | /*crop_left=*/fuzztest::InRange<int>(0, 10), |
325 | 22 | /*crop_top=*/fuzztest::InRange<int>(0, 10), |
326 | 22 | /*crop_width=*/fuzztest::InRange<int>(1, 10), |
327 | 22 | /*crop_height=*/fuzztest::InRange<int>(1, 10), |
328 | 22 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), |
329 | 22 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), |
330 | 22 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), |
331 | 22 | /*use_threads=*/fuzztest::InRange<int>(0, 1), |
332 | 22 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), |
333 | 22 | /*flip=*/fuzztest::InRange<int>(0, 1), |
334 | 22 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); |
335 | 22 | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() enc_dec_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Line | Count | Source | 291 | 16 | static inline auto ArbitraryValidWebPDecoderOptions() { | 292 | 16 | return fuzztest::Map( | 293 | 16 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 294 | 16 | int crop_left, int crop_top, int crop_width, int crop_height, | 295 | 16 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 296 | 16 | int dithering_strength, int flip, | 297 | 16 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 298 | 16 | WebPDecoderOptions options; | 299 | 16 | options.bypass_filtering = bypass_filtering; | 300 | 16 | options.no_fancy_upsampling = no_fancy_upsampling; | 301 | 16 | options.use_cropping = use_cropping; | 302 | 16 | options.crop_left = crop_left; | 303 | 16 | options.crop_top = crop_top; | 304 | 16 | options.crop_width = crop_width; | 305 | 16 | options.crop_height = crop_height; | 306 | 16 | options.use_scaling = use_scaling; | 307 | 16 | options.scaled_width = scaled_width; | 308 | 16 | options.scaled_height = scaled_height; | 309 | 16 | options.use_threads = use_threads; | 310 | 16 | options.dithering_strength = dithering_strength; | 311 | 16 | options.flip = flip; | 312 | 16 | options.alpha_dithering_strength = alpha_dithering_strength; | 313 | 16 | WebPDecoderConfig config; | 314 | 16 | if (!WebPInitDecoderConfig(&config)) assert(false); | 315 | 16 | config.options = options; | 316 | 16 | if (!WebPValidateDecoderConfig(&config)) assert(false); | 317 | 16 | WebPDecoderOptionsCpp options_cpp; | 318 | 16 | std::memcpy(&options_cpp, &options, sizeof(options)); | 319 | 16 | return options_cpp; | 320 | 16 | }, | 321 | 16 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), | 322 | 16 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), | 323 | 16 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), | 324 | 16 | /*crop_left=*/fuzztest::InRange<int>(0, 10), | 325 | 16 | /*crop_top=*/fuzztest::InRange<int>(0, 10), | 326 | 16 | /*crop_width=*/fuzztest::InRange<int>(1, 10), | 327 | 16 | /*crop_height=*/fuzztest::InRange<int>(1, 10), | 328 | 16 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), | 329 | 16 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), | 330 | 16 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), | 331 | 16 | /*use_threads=*/fuzztest::InRange<int>(0, 1), | 332 | 16 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), | 333 | 16 | /*flip=*/fuzztest::InRange<int>(0, 1), | 334 | 16 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); | 335 | 16 | } |
Unexecuted instantiation: animencoder_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: enc_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() dec_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Line | Count | Source | 291 | 4 | static inline auto ArbitraryValidWebPDecoderOptions() { | 292 | 4 | return fuzztest::Map( | 293 | 4 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 294 | 4 | int crop_left, int crop_top, int crop_width, int crop_height, | 295 | 4 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 296 | 4 | int dithering_strength, int flip, | 297 | 4 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 298 | 4 | WebPDecoderOptions options; | 299 | 4 | options.bypass_filtering = bypass_filtering; | 300 | 4 | options.no_fancy_upsampling = no_fancy_upsampling; | 301 | 4 | options.use_cropping = use_cropping; | 302 | 4 | options.crop_left = crop_left; | 303 | 4 | options.crop_top = crop_top; | 304 | 4 | options.crop_width = crop_width; | 305 | 4 | options.crop_height = crop_height; | 306 | 4 | options.use_scaling = use_scaling; | 307 | 4 | options.scaled_width = scaled_width; | 308 | 4 | options.scaled_height = scaled_height; | 309 | 4 | options.use_threads = use_threads; | 310 | 4 | options.dithering_strength = dithering_strength; | 311 | 4 | options.flip = flip; | 312 | 4 | options.alpha_dithering_strength = alpha_dithering_strength; | 313 | 4 | WebPDecoderConfig config; | 314 | 4 | if (!WebPInitDecoderConfig(&config)) assert(false); | 315 | 4 | config.options = options; | 316 | 4 | if (!WebPValidateDecoderConfig(&config)) assert(false); | 317 | 4 | WebPDecoderOptionsCpp options_cpp; | 318 | 4 | std::memcpy(&options_cpp, &options, sizeof(options)); | 319 | 4 | return options_cpp; | 320 | 4 | }, | 321 | 4 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), | 322 | 4 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), | 323 | 4 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), | 324 | 4 | /*crop_left=*/fuzztest::InRange<int>(0, 10), | 325 | 4 | /*crop_top=*/fuzztest::InRange<int>(0, 10), | 326 | 4 | /*crop_width=*/fuzztest::InRange<int>(1, 10), | 327 | 4 | /*crop_height=*/fuzztest::InRange<int>(1, 10), | 328 | 4 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), | 329 | 4 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), | 330 | 4 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), | 331 | 4 | /*use_threads=*/fuzztest::InRange<int>(0, 1), | 332 | 4 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), | 333 | 4 | /*flip=*/fuzztest::InRange<int>(0, 1), | 334 | 4 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); | 335 | 4 | } |
advanced_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Line | Count | Source | 291 | 2 | static inline auto ArbitraryValidWebPDecoderOptions() { | 292 | 2 | return fuzztest::Map( | 293 | 2 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 294 | 2 | int crop_left, int crop_top, int crop_width, int crop_height, | 295 | 2 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 296 | 2 | int dithering_strength, int flip, | 297 | 2 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 298 | 2 | WebPDecoderOptions options; | 299 | 2 | options.bypass_filtering = bypass_filtering; | 300 | 2 | options.no_fancy_upsampling = no_fancy_upsampling; | 301 | 2 | options.use_cropping = use_cropping; | 302 | 2 | options.crop_left = crop_left; | 303 | 2 | options.crop_top = crop_top; | 304 | 2 | options.crop_width = crop_width; | 305 | 2 | options.crop_height = crop_height; | 306 | 2 | options.use_scaling = use_scaling; | 307 | 2 | options.scaled_width = scaled_width; | 308 | 2 | options.scaled_height = scaled_height; | 309 | 2 | options.use_threads = use_threads; | 310 | 2 | options.dithering_strength = dithering_strength; | 311 | 2 | options.flip = flip; | 312 | 2 | options.alpha_dithering_strength = alpha_dithering_strength; | 313 | 2 | WebPDecoderConfig config; | 314 | 2 | if (!WebPInitDecoderConfig(&config)) assert(false); | 315 | 2 | config.options = options; | 316 | 2 | if (!WebPValidateDecoderConfig(&config)) assert(false); | 317 | 2 | WebPDecoderOptionsCpp options_cpp; | 318 | 2 | std::memcpy(&options_cpp, &options, sizeof(options)); | 319 | 2 | return options_cpp; | 320 | 2 | }, | 321 | 2 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), | 322 | 2 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), | 323 | 2 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), | 324 | 2 | /*crop_left=*/fuzztest::InRange<int>(0, 10), | 325 | 2 | /*crop_top=*/fuzztest::InRange<int>(0, 10), | 326 | 2 | /*crop_width=*/fuzztest::InRange<int>(1, 10), | 327 | 2 | /*crop_height=*/fuzztest::InRange<int>(1, 10), | 328 | 2 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), | 329 | 2 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), | 330 | 2 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), | 331 | 2 | /*use_threads=*/fuzztest::InRange<int>(0, 1), | 332 | 2 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), | 333 | 2 | /*flip=*/fuzztest::InRange<int>(0, 1), | 334 | 2 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); | 335 | 2 | } |
Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() |
336 | | |
337 | 16 | static inline auto ArbitraryWebPDecoderOptions() { |
338 | 16 | return fuzztest::Map( |
339 | 16 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, |
340 | 16 | int crop_left, int crop_top, int crop_width, int crop_height, |
341 | 16 | int use_scaling, int scaled_width, int scaled_height, int use_threads, |
342 | 16 | int dithering_strength, int flip, |
343 | 27.7k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { |
344 | 27.7k | WebPDecoderOptions options; |
345 | 27.7k | options.bypass_filtering = bypass_filtering; |
346 | 27.7k | options.no_fancy_upsampling = no_fancy_upsampling; |
347 | 27.7k | options.use_cropping = use_cropping; |
348 | 27.7k | options.crop_left = crop_left; |
349 | 27.7k | options.crop_top = crop_top; |
350 | 27.7k | options.crop_width = crop_width; |
351 | 27.7k | options.crop_height = crop_height; |
352 | 27.7k | options.use_scaling = use_scaling; |
353 | 27.7k | options.scaled_width = scaled_width; |
354 | 27.7k | options.scaled_height = scaled_height; |
355 | 27.7k | options.use_threads = use_threads; |
356 | 27.7k | options.dithering_strength = dithering_strength; |
357 | 27.7k | options.flip = flip; |
358 | 27.7k | options.alpha_dithering_strength = alpha_dithering_strength; |
359 | 27.7k | WebPDecoderOptionsCpp options_cpp; |
360 | 27.7k | std::memcpy(&options_cpp, &options, sizeof(options)); |
361 | 27.7k | return options_cpp; |
362 | 27.7k | }, |
363 | 16 | /*bypass_filtering=*/fuzztest::Arbitrary<int>(), |
364 | 16 | /*no_fancy_upsampling=*/fuzztest::Arbitrary<int>(), |
365 | 16 | /*use_cropping=*/fuzztest::Arbitrary<int>(), |
366 | 16 | /*crop_left=*/fuzztest::Arbitrary<int>(), |
367 | 16 | /*crop_top=*/fuzztest::Arbitrary<int>(), |
368 | 16 | /*crop_width=*/fuzztest::Arbitrary<int>(), |
369 | 16 | /*crop_height=*/fuzztest::Arbitrary<int>(), |
370 | 16 | /*use_scaling=*/fuzztest::Arbitrary<int>(), |
371 | 16 | /*scaled_width=*/fuzztest::Arbitrary<int>(), |
372 | 16 | /*scaled_height=*/fuzztest::Arbitrary<int>(), |
373 | 16 | /*use_threads=*/fuzztest::Arbitrary<int>(), |
374 | 16 | /*dithering_strength=*/fuzztest::Arbitrary<int>(), |
375 | 16 | /*flip=*/fuzztest::Arbitrary<int>(), |
376 | 16 | /*alpha_dithering_strength=*/fuzztest::Arbitrary<int>()); |
377 | 16 | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Line | Count | Source | 337 | 16 | static inline auto ArbitraryWebPDecoderOptions() { | 338 | 16 | return fuzztest::Map( | 339 | 16 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 340 | 16 | int crop_left, int crop_top, int crop_width, int crop_height, | 341 | 16 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 342 | 16 | int dithering_strength, int flip, | 343 | 16 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 344 | 16 | WebPDecoderOptions options; | 345 | 16 | options.bypass_filtering = bypass_filtering; | 346 | 16 | options.no_fancy_upsampling = no_fancy_upsampling; | 347 | 16 | options.use_cropping = use_cropping; | 348 | 16 | options.crop_left = crop_left; | 349 | 16 | options.crop_top = crop_top; | 350 | 16 | options.crop_width = crop_width; | 351 | 16 | options.crop_height = crop_height; | 352 | 16 | options.use_scaling = use_scaling; | 353 | 16 | options.scaled_width = scaled_width; | 354 | 16 | options.scaled_height = scaled_height; | 355 | 16 | options.use_threads = use_threads; | 356 | 16 | options.dithering_strength = dithering_strength; | 357 | 16 | options.flip = flip; | 358 | 16 | options.alpha_dithering_strength = alpha_dithering_strength; | 359 | 16 | WebPDecoderOptionsCpp options_cpp; | 360 | 16 | std::memcpy(&options_cpp, &options, sizeof(options)); | 361 | 16 | return options_cpp; | 362 | 16 | }, | 363 | 16 | /*bypass_filtering=*/fuzztest::Arbitrary<int>(), | 364 | 16 | /*no_fancy_upsampling=*/fuzztest::Arbitrary<int>(), | 365 | 16 | /*use_cropping=*/fuzztest::Arbitrary<int>(), | 366 | 16 | /*crop_left=*/fuzztest::Arbitrary<int>(), | 367 | 16 | /*crop_top=*/fuzztest::Arbitrary<int>(), | 368 | 16 | /*crop_width=*/fuzztest::Arbitrary<int>(), | 369 | 16 | /*crop_height=*/fuzztest::Arbitrary<int>(), | 370 | 16 | /*use_scaling=*/fuzztest::Arbitrary<int>(), | 371 | 16 | /*scaled_width=*/fuzztest::Arbitrary<int>(), | 372 | 16 | /*scaled_height=*/fuzztest::Arbitrary<int>(), | 373 | 16 | /*use_threads=*/fuzztest::Arbitrary<int>(), | 374 | 16 | /*dithering_strength=*/fuzztest::Arbitrary<int>(), | 375 | 16 | /*flip=*/fuzztest::Arbitrary<int>(), | 376 | 16 | /*alpha_dithering_strength=*/fuzztest::Arbitrary<int>()); | 377 | 16 | } |
Unexecuted instantiation: animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: enc_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: dec_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: advanced_api_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() |
378 | | |
379 | | struct CropOrScaleParams { |
380 | | bool alter_input; |
381 | | bool crop_or_scale; |
382 | | int width_ratio; |
383 | | int height_ratio; |
384 | | int left_ratio; |
385 | | int top_ratio; |
386 | | }; |
387 | | |
388 | 42 | static inline auto ArbitraryCropOrScaleParams() { |
389 | 42 | return fuzztest::Map( |
390 | 42 | [](const std::optional<std::pair<int, int>>& width_height_ratio, |
391 | 42 | const std::optional<std::pair<int, int>>& left_top_ratio) |
392 | 104k | -> CropOrScaleParams { |
393 | 104k | CropOrScaleParams params; |
394 | 104k | params.alter_input = width_height_ratio.has_value(); |
395 | 104k | if (params.alter_input) { |
396 | 46.3k | params.width_ratio = width_height_ratio->first; |
397 | 46.3k | params.height_ratio = width_height_ratio->second; |
398 | 46.3k | params.crop_or_scale = left_top_ratio.has_value(); |
399 | 46.3k | if (params.crop_or_scale) { |
400 | 12.1k | params.left_ratio = left_top_ratio->first; |
401 | 12.1k | params.top_ratio = left_top_ratio->second; |
402 | 12.1k | } |
403 | 46.3k | } |
404 | 104k | return params; |
405 | 104k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams()::{lambda(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&)#1}::operator()(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&) constLine | Count | Source | 392 | 53.6k | -> CropOrScaleParams { | 393 | 53.6k | CropOrScaleParams params; | 394 | 53.6k | params.alter_input = width_height_ratio.has_value(); | 395 | 53.6k | if (params.alter_input) { | 396 | 24.5k | params.width_ratio = width_height_ratio->first; | 397 | 24.5k | params.height_ratio = width_height_ratio->second; | 398 | 24.5k | params.crop_or_scale = left_top_ratio.has_value(); | 399 | 24.5k | if (params.crop_or_scale) { | 400 | 5.03k | params.left_ratio = left_top_ratio->first; | 401 | 5.03k | params.top_ratio = left_top_ratio->second; | 402 | 5.03k | } | 403 | 24.5k | } | 404 | 53.6k | return params; | 405 | 53.6k | }, |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams()::{lambda(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&)#1}::operator()(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&) constLine | Count | Source | 392 | 37.0k | -> CropOrScaleParams { | 393 | 37.0k | CropOrScaleParams params; | 394 | 37.0k | params.alter_input = width_height_ratio.has_value(); | 395 | 37.0k | if (params.alter_input) { | 396 | 15.2k | params.width_ratio = width_height_ratio->first; | 397 | 15.2k | params.height_ratio = width_height_ratio->second; | 398 | 15.2k | params.crop_or_scale = left_top_ratio.has_value(); | 399 | 15.2k | if (params.crop_or_scale) { | 400 | 6.09k | params.left_ratio = left_top_ratio->first; | 401 | 6.09k | params.top_ratio = left_top_ratio->second; | 402 | 6.09k | } | 403 | 15.2k | } | 404 | 37.0k | return params; | 405 | 37.0k | }, |
enc_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams()::{lambda(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&)#1}::operator()(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&) constLine | Count | Source | 392 | 13.7k | -> CropOrScaleParams { | 393 | 13.7k | CropOrScaleParams params; | 394 | 13.7k | params.alter_input = width_height_ratio.has_value(); | 395 | 13.7k | if (params.alter_input) { | 396 | 6.57k | params.width_ratio = width_height_ratio->first; | 397 | 6.57k | params.height_ratio = width_height_ratio->second; | 398 | 6.57k | params.crop_or_scale = left_top_ratio.has_value(); | 399 | 6.57k | if (params.crop_or_scale) { | 400 | 1.03k | params.left_ratio = left_top_ratio->first; | 401 | 1.03k | params.top_ratio = left_top_ratio->second; | 402 | 1.03k | } | 403 | 6.57k | } | 404 | 13.7k | return params; | 405 | 13.7k | }, |
|
406 | 42 | fuzztest::OptionalOf( |
407 | 42 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), |
408 | 42 | fuzztest::OptionalOf( |
409 | 42 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); |
410 | 42 | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() enc_dec_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Line | Count | Source | 388 | 32 | static inline auto ArbitraryCropOrScaleParams() { | 389 | 32 | return fuzztest::Map( | 390 | 32 | [](const std::optional<std::pair<int, int>>& width_height_ratio, | 391 | 32 | const std::optional<std::pair<int, int>>& left_top_ratio) | 392 | 32 | -> CropOrScaleParams { | 393 | 32 | CropOrScaleParams params; | 394 | 32 | params.alter_input = width_height_ratio.has_value(); | 395 | 32 | if (params.alter_input) { | 396 | 32 | params.width_ratio = width_height_ratio->first; | 397 | 32 | params.height_ratio = width_height_ratio->second; | 398 | 32 | params.crop_or_scale = left_top_ratio.has_value(); | 399 | 32 | if (params.crop_or_scale) { | 400 | 32 | params.left_ratio = left_top_ratio->first; | 401 | 32 | params.top_ratio = left_top_ratio->second; | 402 | 32 | } | 403 | 32 | } | 404 | 32 | return params; | 405 | 32 | }, | 406 | 32 | fuzztest::OptionalOf( | 407 | 32 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), | 408 | 32 | fuzztest::OptionalOf( | 409 | 32 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); | 410 | 32 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Line | Count | Source | 388 | 8 | static inline auto ArbitraryCropOrScaleParams() { | 389 | 8 | return fuzztest::Map( | 390 | 8 | [](const std::optional<std::pair<int, int>>& width_height_ratio, | 391 | 8 | const std::optional<std::pair<int, int>>& left_top_ratio) | 392 | 8 | -> CropOrScaleParams { | 393 | 8 | CropOrScaleParams params; | 394 | 8 | params.alter_input = width_height_ratio.has_value(); | 395 | 8 | if (params.alter_input) { | 396 | 8 | params.width_ratio = width_height_ratio->first; | 397 | 8 | params.height_ratio = width_height_ratio->second; | 398 | 8 | params.crop_or_scale = left_top_ratio.has_value(); | 399 | 8 | if (params.crop_or_scale) { | 400 | 8 | params.left_ratio = left_top_ratio->first; | 401 | 8 | params.top_ratio = left_top_ratio->second; | 402 | 8 | } | 403 | 8 | } | 404 | 8 | return params; | 405 | 8 | }, | 406 | 8 | fuzztest::OptionalOf( | 407 | 8 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), | 408 | 8 | fuzztest::OptionalOf( | 409 | 8 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); | 410 | 8 | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() enc_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Line | Count | Source | 388 | 2 | static inline auto ArbitraryCropOrScaleParams() { | 389 | 2 | return fuzztest::Map( | 390 | 2 | [](const std::optional<std::pair<int, int>>& width_height_ratio, | 391 | 2 | const std::optional<std::pair<int, int>>& left_top_ratio) | 392 | 2 | -> CropOrScaleParams { | 393 | 2 | CropOrScaleParams params; | 394 | 2 | params.alter_input = width_height_ratio.has_value(); | 395 | 2 | if (params.alter_input) { | 396 | 2 | params.width_ratio = width_height_ratio->first; | 397 | 2 | params.height_ratio = width_height_ratio->second; | 398 | 2 | params.crop_or_scale = left_top_ratio.has_value(); | 399 | 2 | if (params.crop_or_scale) { | 400 | 2 | params.left_ratio = left_top_ratio->first; | 401 | 2 | params.top_ratio = left_top_ratio->second; | 402 | 2 | } | 403 | 2 | } | 404 | 2 | return params; | 405 | 2 | }, | 406 | 2 | fuzztest::OptionalOf( | 407 | 2 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), | 408 | 2 | fuzztest::OptionalOf( | 409 | 2 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); | 410 | 2 | } |
Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: dec_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: advanced_api_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() |
411 | | |
412 | | // Crops or scales a picture according to the given params. |
413 | | int CropOrScale(WebPPicture* pic, const CropOrScaleParams& params); |
414 | | |
415 | | // Imposes a level of optimization among one of the kMaxOptimizationIndex+1 |
416 | | // possible values: OnlyC, ForceSlowSSSE3, NoSSE41, NoAVX, default. |
417 | | static constexpr uint32_t kMaxOptimizationIndex = 4; |
418 | | void SetOptimization(VP8CPUInfo default_VP8GetCPUInfo, uint32_t index); |
419 | | |
420 | | //------------------------------------------------------------------------------ |
421 | | |
422 | | // See https://developers.google.com/speed/webp/docs/riff_container. |
423 | | static constexpr size_t kMaxWebPFileSize = (1ull << 32) - 2; // 4 GiB - 2 |
424 | | |
425 | | std::vector<std::string> GetDictionaryFromFiles( |
426 | | const std::vector<std::string_view>& file_paths); |
427 | | |
428 | | // Checks whether the binary blob containing a JPEG or WebP is too big for the |
429 | | // fuzzer. |
430 | | bool IsImageTooBig(const uint8_t* data, size_t size); |
431 | | |
432 | | } // namespace fuzz_utils |
433 | | |
434 | | #endif // WEBP_TESTS_FUZZER_FUZZ_UTILS_H_ |