/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/demux.h" |
40 | | #include "src/webp/encode.h" |
41 | | #include "src/webp/mux.h" |
42 | | #include "src/webp/types.h" |
43 | | |
44 | | namespace fuzz_utils { |
45 | | |
46 | | //------------------------------------------------------------------------------ |
47 | | // Arbitrary limits to prevent OOM, timeout, or slow execution. |
48 | | |
49 | | // The decoded image size, and for animations additionally the canvas size. |
50 | | // Enabling some sanitizers slow down runtime significantly. |
51 | | // Use a very low threshold in this case to avoid timeouts. |
52 | | #if defined(__SANITIZE_ADDRESS__) // GCC |
53 | | static const uint64_t kFuzzPxLimit = 1024 * 1024 / 10; |
54 | | #elif !defined(__has_feature) // Clang |
55 | | static const uint64_t kFuzzPxLimit = 1024 * 1024; |
56 | | #elif __has_feature(address_sanitizer) || __has_feature(memory_sanitizer) |
57 | | static const uint64_t kFuzzPxLimit = 1024 * 1024 / 18; |
58 | | #else |
59 | | static const uint64_t kFuzzPxLimit = 1024 * 1024; |
60 | | #endif |
61 | | |
62 | | // Demuxed or decoded animation frames. |
63 | | static const int kFuzzFrameLimit = 3; |
64 | | |
65 | | // Reads and sums (up to) 128 spread-out bytes. |
66 | 12.2k | static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) { |
67 | 12.2k | uint8_t value = 0; |
68 | 12.2k | size_t incr = size / 128; |
69 | 12.2k | if (!incr) incr = 1; |
70 | 570k | for (size_t i = 0; i < size; i += incr) value += data[i]; |
71 | 12.2k | return value; |
72 | 12.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: anim_util_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 | 66 | 7.46k | static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) { | 67 | 7.46k | uint8_t value = 0; | 68 | 7.46k | size_t incr = size / 128; | 69 | 7.46k | if (!incr) incr = 1; | 70 | 368k | for (size_t i = 0; i < size; i += incr) value += data[i]; | 71 | 7.46k | return value; | 72 | 7.46k | } |
simple_api_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) Line | Count | Source | 66 | 4.77k | static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) { | 67 | 4.77k | uint8_t value = 0; | 68 | 4.77k | size_t incr = size / 128; | 69 | 4.77k | if (!incr) incr = 1; | 70 | 202k | for (size_t i = 0; i < size; i += incr) value += data[i]; | 71 | 4.77k | return value; | 72 | 4.77k | } |
Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long) |
73 | | |
74 | | #ifdef __cplusplus |
75 | | extern "C" VP8CPUInfo VP8GetCPUInfo; |
76 | | #else |
77 | | extern VP8CPUInfo VP8GetCPUInfo; |
78 | | #endif |
79 | | |
80 | | //------------------------------------------------------------------------------ |
81 | | |
82 | | constexpr const uint8_t* kImagesData[] = {kImgAlphaData, kImgGridData, |
83 | | kImgPeakData}; |
84 | | constexpr size_t kNumSourceImages = |
85 | | sizeof(kImagesData) / sizeof(kImagesData[0]); |
86 | | |
87 | | WebPPicture GetSourcePicture(int image_index, bool use_argb); |
88 | | |
89 | | // Struct to use in a unique_ptr to free the memory. |
90 | | struct UniquePtrDeleter { |
91 | 48.3k | void operator()(WebPMemoryWriter* writer) const { |
92 | 48.3k | WebPMemoryWriterClear(writer); |
93 | 48.3k | } |
94 | 0 | void operator()(WebPPicture* pic) const { WebPPictureFree(pic); } |
95 | 65.3k | void operator()(WebPDecoderConfig* config) const { |
96 | 65.3k | WebPFreeDecBuffer(&config->output); |
97 | 65.3k | } |
98 | 6.05k | void operator()(WebPDemuxer* demux) const { WebPDemuxDelete(demux); } |
99 | 5.55k | void operator()(WebPIterator* iter) const { WebPDemuxReleaseIterator(iter); } |
100 | 2.26k | void operator()(WebPMux* mux) const { WebPMuxDelete(mux); } |
101 | | }; |
102 | | |
103 | | // Like WebPPicture but with no C array. |
104 | | // This can be removed once b/294098900 is fixed. |
105 | | struct WebPPictureCpp { |
106 | | inline WebPPictureCpp(int use_argb, WebPEncCSP colorspace, int width, |
107 | | int height, uint8_t* y, uint8_t* u, uint8_t* v, |
108 | | int y_stride, int uv_stride, uint8_t* a, int a_stride, |
109 | | uint32_t* argb, int argb_stride, void* memory, |
110 | 85.1k | void* memory_argb) { |
111 | 85.1k | pic.reset(new WebPPicture(), [](WebPPicture* pic) { |
112 | 85.1k | WebPPictureFree(pic); |
113 | 85.1k | delete pic; |
114 | 85.1k | }); |
115 | 85.1k | if (!WebPPictureInit(pic.get())) assert(false); |
116 | 85.1k | pic->use_argb = use_argb; |
117 | 85.1k | pic->colorspace = colorspace; |
118 | 85.1k | pic->width = width; |
119 | 85.1k | pic->height = height; |
120 | 85.1k | pic->y = y; |
121 | 85.1k | pic->u = u; |
122 | 85.1k | pic->v = v; |
123 | 85.1k | pic->a = a; |
124 | 85.1k | pic->y_stride = y_stride; |
125 | 85.1k | pic->uv_stride = uv_stride; |
126 | 85.1k | pic->a_stride = a_stride; |
127 | 85.1k | pic->argb = argb; |
128 | 85.1k | pic->argb_stride = argb_stride; |
129 | 85.1k | pic->memory_ = memory; |
130 | 85.1k | pic->memory_argb_ = memory_argb; |
131 | 85.1k | } |
132 | 85.1k | WebPPicture& ref() const { return const_cast<WebPPicture&>(*pic); } |
133 | | std::shared_ptr<WebPPicture> pic; |
134 | | }; |
135 | | |
136 | | static inline WebPPictureCpp CreateTiledWebPPicture( |
137 | 4.29k | int width, int height, const std::vector<uint8_t>& data) { |
138 | 4.29k | WebPPicture pic; |
139 | 4.29k | if (!WebPPictureInit(&pic)) assert(false); |
140 | 4.29k | pic.use_argb = 1; |
141 | 4.29k | pic.colorspace = WEBP_YUV420; |
142 | 4.29k | pic.width = width; |
143 | 4.29k | pic.height = height; |
144 | 4.29k | if (!WebPPictureAlloc(&pic)) assert(false); |
145 | | // Fill each 16x16 tile with the 4^4 = 256 Cartesian product combinations of |
146 | | // 4 byte values per channel (A, R, G, B) via an invertible linear map over |
147 | | // Z_4^4. Each channel uses 4 symbols per tile (low per-tile channel entropy, |
148 | | // preventing tiles from merging when > 200 groups are formed), while all 256 |
149 | | // ARGB pixels within a tile are distinct (preventing LZ77 backward references |
150 | | // from collapsing the tile). Tiles 1..16 can reuse tile 0's palette so |
151 | | // histogram combining merges them and swaps the last tiles into slots 1..16, |
152 | | // producing > 200 used Huffman groups in non-identity order. |
153 | 4.29k | const int tiles_x = (width + 15) / 16; |
154 | 1.09M | for (int y = 0; y < height; ++y) { |
155 | 278M | for (int x = 0; x < width; ++x) { |
156 | 277M | int tile = (y / 16) * tiles_x + (x / 16); |
157 | 277M | if (tile >= 1 && tile <= 16 && (data[tile * 16] & 3) == 0) { |
158 | 4.39M | tile = 0; |
159 | 4.39M | } |
160 | 277M | const int a0 = x & 3, a1 = (x >> 2) & 3; |
161 | 277M | const int b0 = y & 3, b1 = (y >> 2) & 3; |
162 | 277M | const int d[4] = {(a0 + b0 + a1) & 3, (a0 + 2 * b0 + b1) & 3, |
163 | 277M | (a0 + b0 + 2 * a1 + b1) & 3, |
164 | 277M | (a0 + 2 * b0 + a1 + 3 * b1) & 3}; |
165 | 1.10G | auto sym = [&](int ch, int idx) -> uint8_t { |
166 | 1.10G | uint32_t h = static_cast<uint32_t>(tile * 16 + ch * 4 + idx + 1); |
167 | 1.10G | h = ((h >> 16) ^ h) * 0x45d9f3bu; |
168 | 1.10G | h = ((h >> 16) ^ h) * 0x45d9f3bu; |
169 | 1.10G | return static_cast<uint8_t>( |
170 | 1.10G | ((h ^ (h >> 16)) ^ data[tile * 16 + ch * 4 + idx]) | 1u); |
171 | 1.10G | }; enc_dec_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&)::{lambda(int, int)#1}::operator()(int, int) constLine | Count | Source | 165 | 415M | auto sym = [&](int ch, int idx) -> uint8_t { | 166 | 415M | uint32_t h = static_cast<uint32_t>(tile * 16 + ch * 4 + idx + 1); | 167 | 415M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 168 | 415M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 169 | 415M | return static_cast<uint8_t>( | 170 | 415M | ((h ^ (h >> 16)) ^ data[tile * 16 + ch * 4 + idx]) | 1u); | 171 | 415M | }; |
animencoder_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&)::{lambda(int, int)#1}::operator()(int, int) constLine | Count | Source | 165 | 451M | auto sym = [&](int ch, int idx) -> uint8_t { | 166 | 451M | uint32_t h = static_cast<uint32_t>(tile * 16 + ch * 4 + idx + 1); | 167 | 451M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 168 | 451M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 169 | 451M | return static_cast<uint8_t>( | 170 | 451M | ((h ^ (h >> 16)) ^ data[tile * 16 + ch * 4 + idx]) | 1u); | 171 | 451M | }; |
enc_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&)::{lambda(int, int)#1}::operator()(int, int) constLine | Count | Source | 165 | 241M | auto sym = [&](int ch, int idx) -> uint8_t { | 166 | 241M | uint32_t h = static_cast<uint32_t>(tile * 16 + ch * 4 + idx + 1); | 167 | 241M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 168 | 241M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 169 | 241M | return static_cast<uint8_t>( | 170 | 241M | ((h ^ (h >> 16)) ^ data[tile * 16 + ch * 4 + idx]) | 1u); | 171 | 241M | }; |
|
172 | 277M | const uint8_t r = sym(0, d[0]); |
173 | 277M | const uint8_t g = sym(1, d[1]); |
174 | 277M | const uint8_t b = sym(2, d[2]); |
175 | 277M | const uint8_t a = sym(3, d[3]); |
176 | 277M | pic.argb[y * pic.argb_stride + x] = |
177 | 277M | (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(r) << 16) | |
178 | 277M | (static_cast<uint32_t>(g) << 8) | static_cast<uint32_t>(b); |
179 | 277M | } |
180 | 1.09M | } |
181 | 4.29k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, pic.height, |
182 | 4.29k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, pic.a, |
183 | 4.29k | pic.a_stride, pic.argb, pic.argb_stride, pic.memory_, |
184 | 4.29k | pic.memory_argb_); |
185 | 4.29k | } Unexecuted instantiation: mux_demux_api_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: imageio_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: fuzz_utils.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: huffman_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) enc_dec_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Line | Count | Source | 137 | 1.61k | int width, int height, const std::vector<uint8_t>& data) { | 138 | 1.61k | WebPPicture pic; | 139 | 1.61k | if (!WebPPictureInit(&pic)) assert(false); | 140 | 1.61k | pic.use_argb = 1; | 141 | 1.61k | pic.colorspace = WEBP_YUV420; | 142 | 1.61k | pic.width = width; | 143 | 1.61k | pic.height = height; | 144 | 1.61k | if (!WebPPictureAlloc(&pic)) assert(false); | 145 | | // Fill each 16x16 tile with the 4^4 = 256 Cartesian product combinations of | 146 | | // 4 byte values per channel (A, R, G, B) via an invertible linear map over | 147 | | // Z_4^4. Each channel uses 4 symbols per tile (low per-tile channel entropy, | 148 | | // preventing tiles from merging when > 200 groups are formed), while all 256 | 149 | | // ARGB pixels within a tile are distinct (preventing LZ77 backward references | 150 | | // from collapsing the tile). Tiles 1..16 can reuse tile 0's palette so | 151 | | // histogram combining merges them and swaps the last tiles into slots 1..16, | 152 | | // producing > 200 used Huffman groups in non-identity order. | 153 | 1.61k | const int tiles_x = (width + 15) / 16; | 154 | 411k | for (int y = 0; y < height; ++y) { | 155 | 104M | for (int x = 0; x < width; ++x) { | 156 | 103M | int tile = (y / 16) * tiles_x + (x / 16); | 157 | 103M | if (tile >= 1 && tile <= 16 && (data[tile * 16] & 3) == 0) { | 158 | 1.66M | tile = 0; | 159 | 1.66M | } | 160 | 103M | const int a0 = x & 3, a1 = (x >> 2) & 3; | 161 | 103M | const int b0 = y & 3, b1 = (y >> 2) & 3; | 162 | 103M | const int d[4] = {(a0 + b0 + a1) & 3, (a0 + 2 * b0 + b1) & 3, | 163 | 103M | (a0 + b0 + 2 * a1 + b1) & 3, | 164 | 103M | (a0 + 2 * b0 + a1 + 3 * b1) & 3}; | 165 | 103M | auto sym = [&](int ch, int idx) -> uint8_t { | 166 | 103M | uint32_t h = static_cast<uint32_t>(tile * 16 + ch * 4 + idx + 1); | 167 | 103M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 168 | 103M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 169 | 103M | return static_cast<uint8_t>( | 170 | 103M | ((h ^ (h >> 16)) ^ data[tile * 16 + ch * 4 + idx]) | 1u); | 171 | 103M | }; | 172 | 103M | const uint8_t r = sym(0, d[0]); | 173 | 103M | const uint8_t g = sym(1, d[1]); | 174 | 103M | const uint8_t b = sym(2, d[2]); | 175 | 103M | const uint8_t a = sym(3, d[3]); | 176 | 103M | pic.argb[y * pic.argb_stride + x] = | 177 | 103M | (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(r) << 16) | | 178 | 103M | (static_cast<uint32_t>(g) << 8) | static_cast<uint32_t>(b); | 179 | 103M | } | 180 | 409k | } | 181 | 1.61k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, pic.height, | 182 | 1.61k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, pic.a, | 183 | 1.61k | pic.a_stride, pic.argb, pic.argb_stride, pic.memory_, | 184 | 1.61k | pic.memory_argb_); | 185 | 1.61k | } |
animencoder_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Line | Count | Source | 137 | 1.74k | int width, int height, const std::vector<uint8_t>& data) { | 138 | 1.74k | WebPPicture pic; | 139 | 1.74k | if (!WebPPictureInit(&pic)) assert(false); | 140 | 1.74k | pic.use_argb = 1; | 141 | 1.74k | pic.colorspace = WEBP_YUV420; | 142 | 1.74k | pic.width = width; | 143 | 1.74k | pic.height = height; | 144 | 1.74k | if (!WebPPictureAlloc(&pic)) assert(false); | 145 | | // Fill each 16x16 tile with the 4^4 = 256 Cartesian product combinations of | 146 | | // 4 byte values per channel (A, R, G, B) via an invertible linear map over | 147 | | // Z_4^4. Each channel uses 4 symbols per tile (low per-tile channel entropy, | 148 | | // preventing tiles from merging when > 200 groups are formed), while all 256 | 149 | | // ARGB pixels within a tile are distinct (preventing LZ77 backward references | 150 | | // from collapsing the tile). Tiles 1..16 can reuse tile 0's palette so | 151 | | // histogram combining merges them and swaps the last tiles into slots 1..16, | 152 | | // producing > 200 used Huffman groups in non-identity order. | 153 | 1.74k | const int tiles_x = (width + 15) / 16; | 154 | 445k | for (int y = 0; y < height; ++y) { | 155 | 113M | for (int x = 0; x < width; ++x) { | 156 | 112M | int tile = (y / 16) * tiles_x + (x / 16); | 157 | 112M | if (tile >= 1 && tile <= 16 && (data[tile * 16] & 3) == 0) { | 158 | 1.79M | tile = 0; | 159 | 1.79M | } | 160 | 112M | const int a0 = x & 3, a1 = (x >> 2) & 3; | 161 | 112M | const int b0 = y & 3, b1 = (y >> 2) & 3; | 162 | 112M | const int d[4] = {(a0 + b0 + a1) & 3, (a0 + 2 * b0 + b1) & 3, | 163 | 112M | (a0 + b0 + 2 * a1 + b1) & 3, | 164 | 112M | (a0 + 2 * b0 + a1 + 3 * b1) & 3}; | 165 | 112M | auto sym = [&](int ch, int idx) -> uint8_t { | 166 | 112M | uint32_t h = static_cast<uint32_t>(tile * 16 + ch * 4 + idx + 1); | 167 | 112M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 168 | 112M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 169 | 112M | return static_cast<uint8_t>( | 170 | 112M | ((h ^ (h >> 16)) ^ data[tile * 16 + ch * 4 + idx]) | 1u); | 171 | 112M | }; | 172 | 112M | const uint8_t r = sym(0, d[0]); | 173 | 112M | const uint8_t g = sym(1, d[1]); | 174 | 112M | const uint8_t b = sym(2, d[2]); | 175 | 112M | const uint8_t a = sym(3, d[3]); | 176 | 112M | pic.argb[y * pic.argb_stride + x] = | 177 | 112M | (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(r) << 16) | | 178 | 112M | (static_cast<uint32_t>(g) << 8) | static_cast<uint32_t>(b); | 179 | 112M | } | 180 | 443k | } | 181 | 1.74k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, pic.height, | 182 | 1.74k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, pic.a, | 183 | 1.74k | pic.a_stride, pic.argb, pic.argb_stride, pic.memory_, | 184 | 1.74k | pic.memory_argb_); | 185 | 1.74k | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) enc_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Line | Count | Source | 137 | 939 | int width, int height, const std::vector<uint8_t>& data) { | 138 | 939 | WebPPicture pic; | 139 | 939 | if (!WebPPictureInit(&pic)) assert(false); | 140 | 939 | pic.use_argb = 1; | 141 | 939 | pic.colorspace = WEBP_YUV420; | 142 | 939 | pic.width = width; | 143 | 939 | pic.height = height; | 144 | 939 | if (!WebPPictureAlloc(&pic)) assert(false); | 145 | | // Fill each 16x16 tile with the 4^4 = 256 Cartesian product combinations of | 146 | | // 4 byte values per channel (A, R, G, B) via an invertible linear map over | 147 | | // Z_4^4. Each channel uses 4 symbols per tile (low per-tile channel entropy, | 148 | | // preventing tiles from merging when > 200 groups are formed), while all 256 | 149 | | // ARGB pixels within a tile are distinct (preventing LZ77 backward references | 150 | | // from collapsing the tile). Tiles 1..16 can reuse tile 0's palette so | 151 | | // histogram combining merges them and swaps the last tiles into slots 1..16, | 152 | | // producing > 200 used Huffman groups in non-identity order. | 153 | 939 | const int tiles_x = (width + 15) / 16; | 154 | 239k | for (int y = 0; y < height; ++y) { | 155 | 60.6M | for (int x = 0; x < width; ++x) { | 156 | 60.4M | int tile = (y / 16) * tiles_x + (x / 16); | 157 | 60.4M | if (tile >= 1 && tile <= 16 && (data[tile * 16] & 3) == 0) { | 158 | 938k | tile = 0; | 159 | 938k | } | 160 | 60.4M | const int a0 = x & 3, a1 = (x >> 2) & 3; | 161 | 60.4M | const int b0 = y & 3, b1 = (y >> 2) & 3; | 162 | 60.4M | const int d[4] = {(a0 + b0 + a1) & 3, (a0 + 2 * b0 + b1) & 3, | 163 | 60.4M | (a0 + b0 + 2 * a1 + b1) & 3, | 164 | 60.4M | (a0 + 2 * b0 + a1 + 3 * b1) & 3}; | 165 | 60.4M | auto sym = [&](int ch, int idx) -> uint8_t { | 166 | 60.4M | uint32_t h = static_cast<uint32_t>(tile * 16 + ch * 4 + idx + 1); | 167 | 60.4M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 168 | 60.4M | h = ((h >> 16) ^ h) * 0x45d9f3bu; | 169 | 60.4M | return static_cast<uint8_t>( | 170 | 60.4M | ((h ^ (h >> 16)) ^ data[tile * 16 + ch * 4 + idx]) | 1u); | 171 | 60.4M | }; | 172 | 60.4M | const uint8_t r = sym(0, d[0]); | 173 | 60.4M | const uint8_t g = sym(1, d[1]); | 174 | 60.4M | const uint8_t b = sym(2, d[2]); | 175 | 60.4M | const uint8_t a = sym(3, d[3]); | 176 | 60.4M | pic.argb[y * pic.argb_stride + x] = | 177 | 60.4M | (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(r) << 16) | | 178 | 60.4M | (static_cast<uint32_t>(g) << 8) | static_cast<uint32_t>(b); | 179 | 60.4M | } | 180 | 238k | } | 181 | 939 | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, pic.height, | 182 | 939 | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, pic.a, | 183 | 939 | pic.a_stride, pic.argb, pic.argb_stride, pic.memory_, | 184 | 939 | pic.memory_argb_); | 185 | 939 | } |
Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: anim_util_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: dec_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: advanced_api_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::CreateTiledWebPPicture(int, int, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&) |
186 | | |
187 | 22 | static inline auto ArbitraryWebPPicture() { |
188 | 22 | return fuzztest::FlatMap( |
189 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A, |
190 | | // 3 is tiled use_argb (up to 256x256, 4 symbols/channel per 16x16 tile). |
191 | 174k | [](int colorspace, int width, int height) { |
192 | 174k | if (colorspace == 3) { |
193 | 12.9k | width = 256 - (width & 7); |
194 | 12.9k | height = 256 - (height & 7); |
195 | 12.9k | } |
196 | 174k | const int uv_width = (width + 1) >> 1; |
197 | 174k | const int uv_height = (height + 1) >> 1; |
198 | 174k | const int tiles_x = (width + 15) / 16; |
199 | 174k | const int tiles_y = (height + 15) / 16; |
200 | | // Create a domain for the vector that strictly obeys the required size. |
201 | 174k | size_t size = width * height; |
202 | 174k | if (colorspace == 0) size *= 4; |
203 | 174k | if (colorspace == 1) size += 2 * uv_width * uv_height; |
204 | 174k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; |
205 | 174k | if (colorspace == 3) size = 16 * tiles_x * tiles_y; |
206 | 174k | auto DataDomain = |
207 | 174k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); |
208 | | |
209 | | // Map the vector domain back into our Image struct, injecting w and h |
210 | 174k | return fuzztest::Map( |
211 | 174k | [colorspace, width, |
212 | 174k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { |
213 | 58.0k | if (colorspace == 3) { |
214 | 4.29k | return CreateTiledWebPPicture(width, height, data); |
215 | 4.29k | } |
216 | 53.7k | WebPPicture pic; |
217 | 53.7k | if (!WebPPictureInit(&pic)) assert(false); |
218 | 53.7k | pic.use_argb = colorspace == 0 ? 1 : 0; |
219 | 53.7k | pic.colorspace = static_cast<WebPEncCSP>( |
220 | 53.7k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); |
221 | 53.7k | pic.width = width; |
222 | 53.7k | pic.height = height; |
223 | 53.7k | if (!WebPPictureAlloc(&pic)) assert(false); |
224 | 53.7k | size_t size = width * height; |
225 | 53.7k | if (pic.use_argb) { |
226 | 6.61k | std::copy(data.begin(), data.begin() + 4 * size, |
227 | 6.61k | (uint8_t*)pic.argb); |
228 | 47.1k | } else { |
229 | | // Y. |
230 | 47.1k | auto iter = data.begin(); |
231 | 47.1k | std::copy(iter, iter + size, (uint8_t*)pic.y); |
232 | 47.1k | iter += size; |
233 | | // A. |
234 | 47.1k | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { |
235 | 12.9k | std::copy(iter, iter + size, (uint8_t*)pic.a); |
236 | 12.9k | iter += size; |
237 | 12.9k | } |
238 | | // U and V. |
239 | 47.1k | const int uv_width = (width + 1) >> 1; |
240 | 47.1k | const int uv_height = (height + 1) >> 1; |
241 | 47.1k | size = uv_width * uv_height; |
242 | 47.1k | std::copy(iter, iter + size, (uint8_t*)pic.u); |
243 | 47.1k | iter += size; |
244 | 47.1k | std::copy(iter, iter + size, (uint8_t*)pic.v); |
245 | 47.1k | } |
246 | 53.7k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, |
247 | 53.7k | pic.height, pic.y, pic.u, pic.v, |
248 | 53.7k | pic.y_stride, pic.uv_stride, pic.a, |
249 | 53.7k | pic.a_stride, pic.argb, pic.argb_stride, |
250 | 53.7k | pic.memory_, pic.memory_argb_); |
251 | 58.0k | }, 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 | 212 | 35.2k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 35.2k | if (colorspace == 3) { | 214 | 1.61k | return CreateTiledWebPPicture(width, height, data); | 215 | 1.61k | } | 216 | 33.6k | WebPPicture pic; | 217 | 33.6k | if (!WebPPictureInit(&pic)) assert(false); | 218 | 33.6k | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 33.6k | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 33.6k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 33.6k | pic.width = width; | 222 | 33.6k | pic.height = height; | 223 | 33.6k | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 33.6k | size_t size = width * height; | 225 | 33.6k | if (pic.use_argb) { | 226 | 2.00k | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 2.00k | (uint8_t*)pic.argb); | 228 | 31.6k | } else { | 229 | | // Y. | 230 | 31.6k | auto iter = data.begin(); | 231 | 31.6k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 31.6k | iter += size; | 233 | | // A. | 234 | 31.6k | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 8.05k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 8.05k | iter += size; | 237 | 8.05k | } | 238 | | // U and V. | 239 | 31.6k | const int uv_width = (width + 1) >> 1; | 240 | 31.6k | const int uv_height = (height + 1) >> 1; | 241 | 31.6k | size = uv_width * uv_height; | 242 | 31.6k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 31.6k | iter += size; | 244 | 31.6k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 31.6k | } | 246 | 33.6k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 33.6k | pic.height, pic.y, pic.u, pic.v, | 248 | 33.6k | pic.y_stride, pic.uv_stride, pic.a, | 249 | 33.6k | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 33.6k | pic.memory_, pic.memory_argb_); | 251 | 35.2k | }, |
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 | 212 | 9.97k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 9.97k | if (colorspace == 3) { | 214 | 1.74k | return CreateTiledWebPPicture(width, height, data); | 215 | 1.74k | } | 216 | 8.23k | WebPPicture pic; | 217 | 8.23k | if (!WebPPictureInit(&pic)) assert(false); | 218 | 8.23k | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 8.23k | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 8.23k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 8.23k | pic.width = width; | 222 | 8.23k | pic.height = height; | 223 | 8.23k | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 8.23k | size_t size = width * height; | 225 | 8.23k | if (pic.use_argb) { | 226 | 3.27k | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 3.27k | (uint8_t*)pic.argb); | 228 | 4.95k | } else { | 229 | | // Y. | 230 | 4.95k | auto iter = data.begin(); | 231 | 4.95k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 4.95k | iter += size; | 233 | | // A. | 234 | 4.95k | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 1.36k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 1.36k | iter += size; | 237 | 1.36k | } | 238 | | // U and V. | 239 | 4.95k | const int uv_width = (width + 1) >> 1; | 240 | 4.95k | const int uv_height = (height + 1) >> 1; | 241 | 4.95k | size = uv_width * uv_height; | 242 | 4.95k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 4.95k | iter += size; | 244 | 4.95k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 4.95k | } | 246 | 8.23k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 8.23k | pic.height, pic.y, pic.u, pic.v, | 248 | 8.23k | pic.y_stride, pic.uv_stride, pic.a, | 249 | 8.23k | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 8.23k | pic.memory_, pic.memory_argb_); | 251 | 9.97k | }, |
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 | 212 | 12.7k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 12.7k | if (colorspace == 3) { | 214 | 939 | return CreateTiledWebPPicture(width, height, data); | 215 | 939 | } | 216 | 11.8k | WebPPicture pic; | 217 | 11.8k | if (!WebPPictureInit(&pic)) assert(false); | 218 | 11.8k | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 11.8k | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 11.8k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 11.8k | pic.width = width; | 222 | 11.8k | pic.height = height; | 223 | 11.8k | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 11.8k | size_t size = width * height; | 225 | 11.8k | if (pic.use_argb) { | 226 | 1.33k | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 1.33k | (uint8_t*)pic.argb); | 228 | 10.4k | } else { | 229 | | // Y. | 230 | 10.4k | auto iter = data.begin(); | 231 | 10.4k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 10.4k | iter += size; | 233 | | // A. | 234 | 10.4k | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 3.53k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 3.53k | iter += size; | 237 | 3.53k | } | 238 | | // U and V. | 239 | 10.4k | const int uv_width = (width + 1) >> 1; | 240 | 10.4k | const int uv_height = (height + 1) >> 1; | 241 | 10.4k | size = uv_width * uv_height; | 242 | 10.4k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 10.4k | iter += size; | 244 | 10.4k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 10.4k | } | 246 | 11.8k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 11.8k | pic.height, pic.y, pic.u, pic.v, | 248 | 11.8k | pic.y_stride, pic.uv_stride, pic.a, | 249 | 11.8k | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 11.8k | pic.memory_, pic.memory_argb_); | 251 | 12.7k | }, |
|
252 | 174k | DataDomain); |
253 | 174k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) constLine | Count | Source | 191 | 106k | [](int colorspace, int width, int height) { | 192 | 106k | if (colorspace == 3) { | 193 | 4.85k | width = 256 - (width & 7); | 194 | 4.85k | height = 256 - (height & 7); | 195 | 4.85k | } | 196 | 106k | const int uv_width = (width + 1) >> 1; | 197 | 106k | const int uv_height = (height + 1) >> 1; | 198 | 106k | const int tiles_x = (width + 15) / 16; | 199 | 106k | const int tiles_y = (height + 15) / 16; | 200 | | // Create a domain for the vector that strictly obeys the required size. | 201 | 106k | size_t size = width * height; | 202 | 106k | if (colorspace == 0) size *= 4; | 203 | 106k | if (colorspace == 1) size += 2 * uv_width * uv_height; | 204 | 106k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 205 | 106k | if (colorspace == 3) size = 16 * tiles_x * tiles_y; | 206 | 106k | auto DataDomain = | 207 | 106k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 208 | | | 209 | | // Map the vector domain back into our Image struct, injecting w and h | 210 | 106k | return fuzztest::Map( | 211 | 106k | [colorspace, width, | 212 | 106k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 106k | if (colorspace == 3) { | 214 | 106k | return CreateTiledWebPPicture(width, height, data); | 215 | 106k | } | 216 | 106k | WebPPicture pic; | 217 | 106k | if (!WebPPictureInit(&pic)) assert(false); | 218 | 106k | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 106k | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 106k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 106k | pic.width = width; | 222 | 106k | pic.height = height; | 223 | 106k | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 106k | size_t size = width * height; | 225 | 106k | if (pic.use_argb) { | 226 | 106k | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 106k | (uint8_t*)pic.argb); | 228 | 106k | } else { | 229 | | // Y. | 230 | 106k | auto iter = data.begin(); | 231 | 106k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 106k | iter += size; | 233 | | // A. | 234 | 106k | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 106k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 106k | iter += size; | 237 | 106k | } | 238 | | // U and V. | 239 | 106k | const int uv_width = (width + 1) >> 1; | 240 | 106k | const int uv_height = (height + 1) >> 1; | 241 | 106k | size = uv_width * uv_height; | 242 | 106k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 106k | iter += size; | 244 | 106k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 106k | } | 246 | 106k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 106k | pic.height, pic.y, pic.u, pic.v, | 248 | 106k | pic.y_stride, pic.uv_stride, pic.a, | 249 | 106k | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 106k | pic.memory_, pic.memory_argb_); | 251 | 106k | }, | 252 | 106k | DataDomain); | 253 | 106k | }, |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) constLine | Count | Source | 191 | 30.1k | [](int colorspace, int width, int height) { | 192 | 30.1k | if (colorspace == 3) { | 193 | 5.23k | width = 256 - (width & 7); | 194 | 5.23k | height = 256 - (height & 7); | 195 | 5.23k | } | 196 | 30.1k | const int uv_width = (width + 1) >> 1; | 197 | 30.1k | const int uv_height = (height + 1) >> 1; | 198 | 30.1k | const int tiles_x = (width + 15) / 16; | 199 | 30.1k | const int tiles_y = (height + 15) / 16; | 200 | | // Create a domain for the vector that strictly obeys the required size. | 201 | 30.1k | size_t size = width * height; | 202 | 30.1k | if (colorspace == 0) size *= 4; | 203 | 30.1k | if (colorspace == 1) size += 2 * uv_width * uv_height; | 204 | 30.1k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 205 | 30.1k | if (colorspace == 3) size = 16 * tiles_x * tiles_y; | 206 | 30.1k | auto DataDomain = | 207 | 30.1k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 208 | | | 209 | | // Map the vector domain back into our Image struct, injecting w and h | 210 | 30.1k | return fuzztest::Map( | 211 | 30.1k | [colorspace, width, | 212 | 30.1k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 30.1k | if (colorspace == 3) { | 214 | 30.1k | return CreateTiledWebPPicture(width, height, data); | 215 | 30.1k | } | 216 | 30.1k | WebPPicture pic; | 217 | 30.1k | if (!WebPPictureInit(&pic)) assert(false); | 218 | 30.1k | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 30.1k | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 30.1k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 30.1k | pic.width = width; | 222 | 30.1k | pic.height = height; | 223 | 30.1k | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 30.1k | size_t size = width * height; | 225 | 30.1k | if (pic.use_argb) { | 226 | 30.1k | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 30.1k | (uint8_t*)pic.argb); | 228 | 30.1k | } else { | 229 | | // Y. | 230 | 30.1k | auto iter = data.begin(); | 231 | 30.1k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 30.1k | iter += size; | 233 | | // A. | 234 | 30.1k | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 30.1k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 30.1k | iter += size; | 237 | 30.1k | } | 238 | | // U and V. | 239 | 30.1k | const int uv_width = (width + 1) >> 1; | 240 | 30.1k | const int uv_height = (height + 1) >> 1; | 241 | 30.1k | size = uv_width * uv_height; | 242 | 30.1k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 30.1k | iter += size; | 244 | 30.1k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 30.1k | } | 246 | 30.1k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 30.1k | pic.height, pic.y, pic.u, pic.v, | 248 | 30.1k | pic.y_stride, pic.uv_stride, pic.a, | 249 | 30.1k | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 30.1k | pic.memory_, pic.memory_argb_); | 251 | 30.1k | }, | 252 | 30.1k | DataDomain); | 253 | 30.1k | }, |
enc_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) constLine | Count | Source | 191 | 38.4k | [](int colorspace, int width, int height) { | 192 | 38.4k | if (colorspace == 3) { | 193 | 2.82k | width = 256 - (width & 7); | 194 | 2.82k | height = 256 - (height & 7); | 195 | 2.82k | } | 196 | 38.4k | const int uv_width = (width + 1) >> 1; | 197 | 38.4k | const int uv_height = (height + 1) >> 1; | 198 | 38.4k | const int tiles_x = (width + 15) / 16; | 199 | 38.4k | const int tiles_y = (height + 15) / 16; | 200 | | // Create a domain for the vector that strictly obeys the required size. | 201 | 38.4k | size_t size = width * height; | 202 | 38.4k | if (colorspace == 0) size *= 4; | 203 | 38.4k | if (colorspace == 1) size += 2 * uv_width * uv_height; | 204 | 38.4k | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 205 | 38.4k | if (colorspace == 3) size = 16 * tiles_x * tiles_y; | 206 | 38.4k | auto DataDomain = | 207 | 38.4k | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 208 | | | 209 | | // Map the vector domain back into our Image struct, injecting w and h | 210 | 38.4k | return fuzztest::Map( | 211 | 38.4k | [colorspace, width, | 212 | 38.4k | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 38.4k | if (colorspace == 3) { | 214 | 38.4k | return CreateTiledWebPPicture(width, height, data); | 215 | 38.4k | } | 216 | 38.4k | WebPPicture pic; | 217 | 38.4k | if (!WebPPictureInit(&pic)) assert(false); | 218 | 38.4k | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 38.4k | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 38.4k | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 38.4k | pic.width = width; | 222 | 38.4k | pic.height = height; | 223 | 38.4k | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 38.4k | size_t size = width * height; | 225 | 38.4k | if (pic.use_argb) { | 226 | 38.4k | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 38.4k | (uint8_t*)pic.argb); | 228 | 38.4k | } else { | 229 | | // Y. | 230 | 38.4k | auto iter = data.begin(); | 231 | 38.4k | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 38.4k | iter += size; | 233 | | // A. | 234 | 38.4k | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 38.4k | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 38.4k | iter += size; | 237 | 38.4k | } | 238 | | // U and V. | 239 | 38.4k | const int uv_width = (width + 1) >> 1; | 240 | 38.4k | const int uv_height = (height + 1) >> 1; | 241 | 38.4k | size = uv_width * uv_height; | 242 | 38.4k | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 38.4k | iter += size; | 244 | 38.4k | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 38.4k | } | 246 | 38.4k | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 38.4k | pic.height, pic.y, pic.u, pic.v, | 248 | 38.4k | pic.y_stride, pic.uv_stride, pic.a, | 249 | 38.4k | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 38.4k | pic.memory_, pic.memory_argb_); | 251 | 38.4k | }, | 252 | 38.4k | DataDomain); | 253 | 38.4k | }, |
|
254 | 22 | /*colorspace=*/fuzztest::InRange<int>(0, 3), |
255 | 22 | /*width=*/fuzztest::InRange<int>(1, 128), |
256 | 22 | /*height=*/fuzztest::InRange<int>(1, 128)); |
257 | 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 | 187 | 16 | static inline auto ArbitraryWebPPicture() { | 188 | 16 | return fuzztest::FlatMap( | 189 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A, | 190 | | // 3 is tiled use_argb (up to 256x256, 4 symbols/channel per 16x16 tile). | 191 | 16 | [](int colorspace, int width, int height) { | 192 | 16 | if (colorspace == 3) { | 193 | 16 | width = 256 - (width & 7); | 194 | 16 | height = 256 - (height & 7); | 195 | 16 | } | 196 | 16 | const int uv_width = (width + 1) >> 1; | 197 | 16 | const int uv_height = (height + 1) >> 1; | 198 | 16 | const int tiles_x = (width + 15) / 16; | 199 | 16 | const int tiles_y = (height + 15) / 16; | 200 | | // Create a domain for the vector that strictly obeys the required size. | 201 | 16 | size_t size = width * height; | 202 | 16 | if (colorspace == 0) size *= 4; | 203 | 16 | if (colorspace == 1) size += 2 * uv_width * uv_height; | 204 | 16 | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 205 | 16 | if (colorspace == 3) size = 16 * tiles_x * tiles_y; | 206 | 16 | auto DataDomain = | 207 | 16 | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 208 | | | 209 | | // Map the vector domain back into our Image struct, injecting w and h | 210 | 16 | return fuzztest::Map( | 211 | 16 | [colorspace, width, | 212 | 16 | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 16 | if (colorspace == 3) { | 214 | 16 | return CreateTiledWebPPicture(width, height, data); | 215 | 16 | } | 216 | 16 | WebPPicture pic; | 217 | 16 | if (!WebPPictureInit(&pic)) assert(false); | 218 | 16 | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 16 | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 16 | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 16 | pic.width = width; | 222 | 16 | pic.height = height; | 223 | 16 | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 16 | size_t size = width * height; | 225 | 16 | if (pic.use_argb) { | 226 | 16 | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 16 | (uint8_t*)pic.argb); | 228 | 16 | } else { | 229 | | // Y. | 230 | 16 | auto iter = data.begin(); | 231 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 16 | iter += size; | 233 | | // A. | 234 | 16 | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 16 | iter += size; | 237 | 16 | } | 238 | | // U and V. | 239 | 16 | const int uv_width = (width + 1) >> 1; | 240 | 16 | const int uv_height = (height + 1) >> 1; | 241 | 16 | size = uv_width * uv_height; | 242 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 16 | iter += size; | 244 | 16 | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 16 | } | 246 | 16 | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 16 | pic.height, pic.y, pic.u, pic.v, | 248 | 16 | pic.y_stride, pic.uv_stride, pic.a, | 249 | 16 | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 16 | pic.memory_, pic.memory_argb_); | 251 | 16 | }, | 252 | 16 | DataDomain); | 253 | 16 | }, | 254 | 16 | /*colorspace=*/fuzztest::InRange<int>(0, 3), | 255 | 16 | /*width=*/fuzztest::InRange<int>(1, 128), | 256 | 16 | /*height=*/fuzztest::InRange<int>(1, 128)); | 257 | 16 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Line | Count | Source | 187 | 4 | static inline auto ArbitraryWebPPicture() { | 188 | 4 | return fuzztest::FlatMap( | 189 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A, | 190 | | // 3 is tiled use_argb (up to 256x256, 4 symbols/channel per 16x16 tile). | 191 | 4 | [](int colorspace, int width, int height) { | 192 | 4 | if (colorspace == 3) { | 193 | 4 | width = 256 - (width & 7); | 194 | 4 | height = 256 - (height & 7); | 195 | 4 | } | 196 | 4 | const int uv_width = (width + 1) >> 1; | 197 | 4 | const int uv_height = (height + 1) >> 1; | 198 | 4 | const int tiles_x = (width + 15) / 16; | 199 | 4 | const int tiles_y = (height + 15) / 16; | 200 | | // Create a domain for the vector that strictly obeys the required size. | 201 | 4 | size_t size = width * height; | 202 | 4 | if (colorspace == 0) size *= 4; | 203 | 4 | if (colorspace == 1) size += 2 * uv_width * uv_height; | 204 | 4 | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 205 | 4 | if (colorspace == 3) size = 16 * tiles_x * tiles_y; | 206 | 4 | auto DataDomain = | 207 | 4 | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 208 | | | 209 | | // Map the vector domain back into our Image struct, injecting w and h | 210 | 4 | return fuzztest::Map( | 211 | 4 | [colorspace, width, | 212 | 4 | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 4 | if (colorspace == 3) { | 214 | 4 | return CreateTiledWebPPicture(width, height, data); | 215 | 4 | } | 216 | 4 | WebPPicture pic; | 217 | 4 | if (!WebPPictureInit(&pic)) assert(false); | 218 | 4 | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 4 | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 4 | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 4 | pic.width = width; | 222 | 4 | pic.height = height; | 223 | 4 | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 4 | size_t size = width * height; | 225 | 4 | if (pic.use_argb) { | 226 | 4 | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 4 | (uint8_t*)pic.argb); | 228 | 4 | } else { | 229 | | // Y. | 230 | 4 | auto iter = data.begin(); | 231 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 4 | iter += size; | 233 | | // A. | 234 | 4 | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 4 | iter += size; | 237 | 4 | } | 238 | | // U and V. | 239 | 4 | const int uv_width = (width + 1) >> 1; | 240 | 4 | const int uv_height = (height + 1) >> 1; | 241 | 4 | size = uv_width * uv_height; | 242 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 4 | iter += size; | 244 | 4 | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 4 | } | 246 | 4 | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 4 | pic.height, pic.y, pic.u, pic.v, | 248 | 4 | pic.y_stride, pic.uv_stride, pic.a, | 249 | 4 | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 4 | pic.memory_, pic.memory_argb_); | 251 | 4 | }, | 252 | 4 | DataDomain); | 253 | 4 | }, | 254 | 4 | /*colorspace=*/fuzztest::InRange<int>(0, 3), | 255 | 4 | /*width=*/fuzztest::InRange<int>(1, 128), | 256 | 4 | /*height=*/fuzztest::InRange<int>(1, 128)); | 257 | 4 | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() enc_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Line | Count | Source | 187 | 2 | static inline auto ArbitraryWebPPicture() { | 188 | 2 | return fuzztest::FlatMap( | 189 | | // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A, | 190 | | // 3 is tiled use_argb (up to 256x256, 4 symbols/channel per 16x16 tile). | 191 | 2 | [](int colorspace, int width, int height) { | 192 | 2 | if (colorspace == 3) { | 193 | 2 | width = 256 - (width & 7); | 194 | 2 | height = 256 - (height & 7); | 195 | 2 | } | 196 | 2 | const int uv_width = (width + 1) >> 1; | 197 | 2 | const int uv_height = (height + 1) >> 1; | 198 | 2 | const int tiles_x = (width + 15) / 16; | 199 | 2 | const int tiles_y = (height + 15) / 16; | 200 | | // Create a domain for the vector that strictly obeys the required size. | 201 | 2 | size_t size = width * height; | 202 | 2 | if (colorspace == 0) size *= 4; | 203 | 2 | if (colorspace == 1) size += 2 * uv_width * uv_height; | 204 | 2 | if (colorspace == 2) size += 2 * uv_width * uv_height + size; | 205 | 2 | if (colorspace == 3) size = 16 * tiles_x * tiles_y; | 206 | 2 | auto DataDomain = | 207 | 2 | fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size); | 208 | | | 209 | | // Map the vector domain back into our Image struct, injecting w and h | 210 | 2 | return fuzztest::Map( | 211 | 2 | [colorspace, width, | 212 | 2 | height](const std::vector<uint8_t>& data) -> WebPPictureCpp { | 213 | 2 | if (colorspace == 3) { | 214 | 2 | return CreateTiledWebPPicture(width, height, data); | 215 | 2 | } | 216 | 2 | WebPPicture pic; | 217 | 2 | if (!WebPPictureInit(&pic)) assert(false); | 218 | 2 | pic.use_argb = colorspace == 0 ? 1 : 0; | 219 | 2 | pic.colorspace = static_cast<WebPEncCSP>( | 220 | 2 | colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A); | 221 | 2 | pic.width = width; | 222 | 2 | pic.height = height; | 223 | 2 | if (!WebPPictureAlloc(&pic)) assert(false); | 224 | 2 | size_t size = width * height; | 225 | 2 | if (pic.use_argb) { | 226 | 2 | std::copy(data.begin(), data.begin() + 4 * size, | 227 | 2 | (uint8_t*)pic.argb); | 228 | 2 | } else { | 229 | | // Y. | 230 | 2 | auto iter = data.begin(); | 231 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.y); | 232 | 2 | iter += size; | 233 | | // A. | 234 | 2 | if (pic.colorspace & WEBP_CSP_ALPHA_BIT) { | 235 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.a); | 236 | 2 | iter += size; | 237 | 2 | } | 238 | | // U and V. | 239 | 2 | const int uv_width = (width + 1) >> 1; | 240 | 2 | const int uv_height = (height + 1) >> 1; | 241 | 2 | size = uv_width * uv_height; | 242 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.u); | 243 | 2 | iter += size; | 244 | 2 | std::copy(iter, iter + size, (uint8_t*)pic.v); | 245 | 2 | } | 246 | 2 | return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width, | 247 | 2 | pic.height, pic.y, pic.u, pic.v, | 248 | 2 | pic.y_stride, pic.uv_stride, pic.a, | 249 | 2 | pic.a_stride, pic.argb, pic.argb_stride, | 250 | 2 | pic.memory_, pic.memory_argb_); | 251 | 2 | }, | 252 | 2 | DataDomain); | 253 | 2 | }, | 254 | 2 | /*colorspace=*/fuzztest::InRange<int>(0, 3), | 255 | 2 | /*width=*/fuzztest::InRange<int>(1, 128), | 256 | 2 | /*height=*/fuzztest::InRange<int>(1, 128)); | 257 | 2 | } |
Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() Unexecuted instantiation: anim_util_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() Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture() |
258 | | |
259 | 20 | static inline auto ArbitraryWebPPictureFromIndex() { |
260 | 20 | return fuzztest::Map( |
261 | 27.0k | [](int index, bool use_argb) -> WebPPictureCpp { |
262 | | // Map the vector domain back into our Image struct, injecting w and h |
263 | 27.0k | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); |
264 | 27.0k | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, |
265 | 27.0k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, |
266 | 27.0k | pic.a, pic.a_stride, pic.argb, pic.argb_stride, |
267 | 27.0k | pic.memory_, pic.memory_argb_); |
268 | 27.0k | }, enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex()::{lambda(int, bool)#1}::operator()(int, bool) constLine | Count | Source | 261 | 13.0k | [](int index, bool use_argb) -> WebPPictureCpp { | 262 | | // Map the vector domain back into our Image struct, injecting w and h | 263 | 13.0k | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 264 | 13.0k | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 265 | 13.0k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 266 | 13.0k | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 267 | 13.0k | pic.memory_, pic.memory_argb_); | 268 | 13.0k | }, |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex()::{lambda(int, bool)#1}::operator()(int, bool) constLine | Count | Source | 261 | 14.0k | [](int index, bool use_argb) -> WebPPictureCpp { | 262 | | // Map the vector domain back into our Image struct, injecting w and h | 263 | 14.0k | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 264 | 14.0k | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 265 | 14.0k | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 266 | 14.0k | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 267 | 14.0k | pic.memory_, pic.memory_argb_); | 268 | 14.0k | }, |
|
269 | 20 | /*index=*/fuzztest::InRange<int>(0, fuzz_utils::kNumSourceImages - 1), |
270 | 20 | /*use_argb=*/fuzztest::Arbitrary<bool>()); |
271 | 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 | 259 | 16 | static inline auto ArbitraryWebPPictureFromIndex() { | 260 | 16 | return fuzztest::Map( | 261 | 16 | [](int index, bool use_argb) -> WebPPictureCpp { | 262 | | // Map the vector domain back into our Image struct, injecting w and h | 263 | 16 | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 264 | 16 | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 265 | 16 | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 266 | 16 | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 267 | 16 | pic.memory_, pic.memory_argb_); | 268 | 16 | }, | 269 | 16 | /*index=*/fuzztest::InRange<int>(0, fuzz_utils::kNumSourceImages - 1), | 270 | 16 | /*use_argb=*/fuzztest::Arbitrary<bool>()); | 271 | 16 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() Line | Count | Source | 259 | 4 | static inline auto ArbitraryWebPPictureFromIndex() { | 260 | 4 | return fuzztest::Map( | 261 | 4 | [](int index, bool use_argb) -> WebPPictureCpp { | 262 | | // Map the vector domain back into our Image struct, injecting w and h | 263 | 4 | WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb); | 264 | 4 | return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height, | 265 | 4 | pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride, | 266 | 4 | pic.a, pic.a_stride, pic.argb, pic.argb_stride, | 267 | 4 | pic.memory_, pic.memory_argb_); | 268 | 4 | }, | 269 | 4 | /*index=*/fuzztest::InRange<int>(0, fuzz_utils::kNumSourceImages - 1), | 270 | 4 | /*use_argb=*/fuzztest::Arbitrary<bool>()); | 271 | 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: anim_util_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() Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex() |
272 | | |
273 | 42 | static inline auto ArbitraryWebPConfig() { |
274 | 42 | return fuzztest::Map( |
275 | 42 | [](int lossless, int quality, int method, int image_hint, int segments, |
276 | 42 | int sns_strength, int filter_strength, int filter_sharpness, |
277 | 42 | int filter_type, int autofilter, int alpha_compression, |
278 | 42 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, |
279 | 42 | int partitions, int partition_limit, int emulate_jpeg_size, |
280 | 42 | int thread_level, int low_memory, int near_lossless, int exact, |
281 | 85.1k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { |
282 | 85.1k | WebPConfig config; |
283 | 85.1k | if (!WebPConfigInit(&config)) assert(false); |
284 | 85.1k | config.lossless = lossless; |
285 | 85.1k | config.quality = quality; |
286 | 85.1k | config.method = method; |
287 | 85.1k | config.image_hint = (WebPImageHint)image_hint; |
288 | 85.1k | config.segments = segments; |
289 | 85.1k | config.sns_strength = sns_strength; |
290 | 85.1k | config.filter_strength = filter_strength; |
291 | 85.1k | config.filter_sharpness = filter_sharpness; |
292 | 85.1k | config.filter_type = filter_type; |
293 | 85.1k | config.autofilter = autofilter; |
294 | 85.1k | config.alpha_compression = alpha_compression; |
295 | 85.1k | config.alpha_filtering = alpha_filtering; |
296 | 85.1k | config.alpha_quality = alpha_quality; |
297 | 85.1k | config.pass = pass; |
298 | 85.1k | config.show_compressed = 1; |
299 | 85.1k | config.preprocessing = preprocessing; |
300 | 85.1k | config.partitions = partitions; |
301 | 85.1k | config.partition_limit = 10 * partition_limit; |
302 | 85.1k | config.emulate_jpeg_size = emulate_jpeg_size; |
303 | 85.1k | config.thread_level = thread_level; |
304 | 85.1k | config.low_memory = low_memory; |
305 | 85.1k | config.near_lossless = 20 * near_lossless; |
306 | 85.1k | config.exact = exact; |
307 | 85.1k | config.use_delta_palette = use_delta_palette; |
308 | 85.1k | config.use_sharp_yuv = use_sharp_yuv; |
309 | 85.1k | if (!WebPValidateConfig(&config)) assert(false); |
310 | 85.1k | return config; |
311 | 85.1k | }, 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 | 281 | 48.3k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 282 | 48.3k | WebPConfig config; | 283 | 48.3k | if (!WebPConfigInit(&config)) assert(false); | 284 | 48.3k | config.lossless = lossless; | 285 | 48.3k | config.quality = quality; | 286 | 48.3k | config.method = method; | 287 | 48.3k | config.image_hint = (WebPImageHint)image_hint; | 288 | 48.3k | config.segments = segments; | 289 | 48.3k | config.sns_strength = sns_strength; | 290 | 48.3k | config.filter_strength = filter_strength; | 291 | 48.3k | config.filter_sharpness = filter_sharpness; | 292 | 48.3k | config.filter_type = filter_type; | 293 | 48.3k | config.autofilter = autofilter; | 294 | 48.3k | config.alpha_compression = alpha_compression; | 295 | 48.3k | config.alpha_filtering = alpha_filtering; | 296 | 48.3k | config.alpha_quality = alpha_quality; | 297 | 48.3k | config.pass = pass; | 298 | 48.3k | config.show_compressed = 1; | 299 | 48.3k | config.preprocessing = preprocessing; | 300 | 48.3k | config.partitions = partitions; | 301 | 48.3k | config.partition_limit = 10 * partition_limit; | 302 | 48.3k | config.emulate_jpeg_size = emulate_jpeg_size; | 303 | 48.3k | config.thread_level = thread_level; | 304 | 48.3k | config.low_memory = low_memory; | 305 | 48.3k | config.near_lossless = 20 * near_lossless; | 306 | 48.3k | config.exact = exact; | 307 | 48.3k | config.use_delta_palette = use_delta_palette; | 308 | 48.3k | config.use_sharp_yuv = use_sharp_yuv; | 309 | 48.3k | if (!WebPValidateConfig(&config)) assert(false); | 310 | 48.3k | return config; | 311 | 48.3k | }, |
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 | 281 | 24.0k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 282 | 24.0k | WebPConfig config; | 283 | 24.0k | if (!WebPConfigInit(&config)) assert(false); | 284 | 24.0k | config.lossless = lossless; | 285 | 24.0k | config.quality = quality; | 286 | 24.0k | config.method = method; | 287 | 24.0k | config.image_hint = (WebPImageHint)image_hint; | 288 | 24.0k | config.segments = segments; | 289 | 24.0k | config.sns_strength = sns_strength; | 290 | 24.0k | config.filter_strength = filter_strength; | 291 | 24.0k | config.filter_sharpness = filter_sharpness; | 292 | 24.0k | config.filter_type = filter_type; | 293 | 24.0k | config.autofilter = autofilter; | 294 | 24.0k | config.alpha_compression = alpha_compression; | 295 | 24.0k | config.alpha_filtering = alpha_filtering; | 296 | 24.0k | config.alpha_quality = alpha_quality; | 297 | 24.0k | config.pass = pass; | 298 | 24.0k | config.show_compressed = 1; | 299 | 24.0k | config.preprocessing = preprocessing; | 300 | 24.0k | config.partitions = partitions; | 301 | 24.0k | config.partition_limit = 10 * partition_limit; | 302 | 24.0k | config.emulate_jpeg_size = emulate_jpeg_size; | 303 | 24.0k | config.thread_level = thread_level; | 304 | 24.0k | config.low_memory = low_memory; | 305 | 24.0k | config.near_lossless = 20 * near_lossless; | 306 | 24.0k | config.exact = exact; | 307 | 24.0k | config.use_delta_palette = use_delta_palette; | 308 | 24.0k | config.use_sharp_yuv = use_sharp_yuv; | 309 | 24.0k | if (!WebPValidateConfig(&config)) assert(false); | 310 | 24.0k | return config; | 311 | 24.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 | 281 | 12.7k | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 282 | 12.7k | WebPConfig config; | 283 | 12.7k | if (!WebPConfigInit(&config)) assert(false); | 284 | 12.7k | config.lossless = lossless; | 285 | 12.7k | config.quality = quality; | 286 | 12.7k | config.method = method; | 287 | 12.7k | config.image_hint = (WebPImageHint)image_hint; | 288 | 12.7k | config.segments = segments; | 289 | 12.7k | config.sns_strength = sns_strength; | 290 | 12.7k | config.filter_strength = filter_strength; | 291 | 12.7k | config.filter_sharpness = filter_sharpness; | 292 | 12.7k | config.filter_type = filter_type; | 293 | 12.7k | config.autofilter = autofilter; | 294 | 12.7k | config.alpha_compression = alpha_compression; | 295 | 12.7k | config.alpha_filtering = alpha_filtering; | 296 | 12.7k | config.alpha_quality = alpha_quality; | 297 | 12.7k | config.pass = pass; | 298 | 12.7k | config.show_compressed = 1; | 299 | 12.7k | config.preprocessing = preprocessing; | 300 | 12.7k | config.partitions = partitions; | 301 | 12.7k | config.partition_limit = 10 * partition_limit; | 302 | 12.7k | config.emulate_jpeg_size = emulate_jpeg_size; | 303 | 12.7k | config.thread_level = thread_level; | 304 | 12.7k | config.low_memory = low_memory; | 305 | 12.7k | config.near_lossless = 20 * near_lossless; | 306 | 12.7k | config.exact = exact; | 307 | 12.7k | config.use_delta_palette = use_delta_palette; | 308 | 12.7k | config.use_sharp_yuv = use_sharp_yuv; | 309 | 12.7k | if (!WebPValidateConfig(&config)) assert(false); | 310 | 12.7k | return config; | 311 | 12.7k | }, |
|
312 | 42 | /*lossless=*/fuzztest::InRange<int>(0, 1), |
313 | 42 | /*quality=*/fuzztest::InRange<int>(0, 100), |
314 | 42 | /*method=*/fuzztest::InRange<int>(0, 6), |
315 | 42 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), |
316 | 42 | /*segments=*/fuzztest::InRange<int>(1, 4), |
317 | 42 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), |
318 | 42 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), |
319 | 42 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), |
320 | 42 | /*filter_type=*/fuzztest::InRange<int>(0, 1), |
321 | 42 | /*autofilter=*/fuzztest::InRange<int>(0, 1), |
322 | 42 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), |
323 | 42 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), |
324 | 42 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), |
325 | 42 | /*pass=*/fuzztest::InRange<int>(1, 10), |
326 | 42 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), |
327 | 42 | /*partitions=*/fuzztest::InRange<int>(0, 3), |
328 | 42 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), |
329 | 42 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), |
330 | 42 | /*thread_level=*/fuzztest::InRange<int>(0, 1), |
331 | 42 | /*low_memory=*/fuzztest::InRange<int>(0, 1), |
332 | 42 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), |
333 | 42 | /*exact=*/fuzztest::InRange<int>(0, 1), |
334 | 42 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), |
335 | 42 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); |
336 | 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 | 273 | 32 | static inline auto ArbitraryWebPConfig() { | 274 | 32 | return fuzztest::Map( | 275 | 32 | [](int lossless, int quality, int method, int image_hint, int segments, | 276 | 32 | int sns_strength, int filter_strength, int filter_sharpness, | 277 | 32 | int filter_type, int autofilter, int alpha_compression, | 278 | 32 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, | 279 | 32 | int partitions, int partition_limit, int emulate_jpeg_size, | 280 | 32 | int thread_level, int low_memory, int near_lossless, int exact, | 281 | 32 | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 282 | 32 | WebPConfig config; | 283 | 32 | if (!WebPConfigInit(&config)) assert(false); | 284 | 32 | config.lossless = lossless; | 285 | 32 | config.quality = quality; | 286 | 32 | config.method = method; | 287 | 32 | config.image_hint = (WebPImageHint)image_hint; | 288 | 32 | config.segments = segments; | 289 | 32 | config.sns_strength = sns_strength; | 290 | 32 | config.filter_strength = filter_strength; | 291 | 32 | config.filter_sharpness = filter_sharpness; | 292 | 32 | config.filter_type = filter_type; | 293 | 32 | config.autofilter = autofilter; | 294 | 32 | config.alpha_compression = alpha_compression; | 295 | 32 | config.alpha_filtering = alpha_filtering; | 296 | 32 | config.alpha_quality = alpha_quality; | 297 | 32 | config.pass = pass; | 298 | 32 | config.show_compressed = 1; | 299 | 32 | config.preprocessing = preprocessing; | 300 | 32 | config.partitions = partitions; | 301 | 32 | config.partition_limit = 10 * partition_limit; | 302 | 32 | config.emulate_jpeg_size = emulate_jpeg_size; | 303 | 32 | config.thread_level = thread_level; | 304 | 32 | config.low_memory = low_memory; | 305 | 32 | config.near_lossless = 20 * near_lossless; | 306 | 32 | config.exact = exact; | 307 | 32 | config.use_delta_palette = use_delta_palette; | 308 | 32 | config.use_sharp_yuv = use_sharp_yuv; | 309 | 32 | if (!WebPValidateConfig(&config)) assert(false); | 310 | 32 | return config; | 311 | 32 | }, | 312 | 32 | /*lossless=*/fuzztest::InRange<int>(0, 1), | 313 | 32 | /*quality=*/fuzztest::InRange<int>(0, 100), | 314 | 32 | /*method=*/fuzztest::InRange<int>(0, 6), | 315 | 32 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), | 316 | 32 | /*segments=*/fuzztest::InRange<int>(1, 4), | 317 | 32 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), | 318 | 32 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), | 319 | 32 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), | 320 | 32 | /*filter_type=*/fuzztest::InRange<int>(0, 1), | 321 | 32 | /*autofilter=*/fuzztest::InRange<int>(0, 1), | 322 | 32 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), | 323 | 32 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), | 324 | 32 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), | 325 | 32 | /*pass=*/fuzztest::InRange<int>(1, 10), | 326 | 32 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), | 327 | 32 | /*partitions=*/fuzztest::InRange<int>(0, 3), | 328 | 32 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), | 329 | 32 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), | 330 | 32 | /*thread_level=*/fuzztest::InRange<int>(0, 1), | 331 | 32 | /*low_memory=*/fuzztest::InRange<int>(0, 1), | 332 | 32 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), | 333 | 32 | /*exact=*/fuzztest::InRange<int>(0, 1), | 334 | 32 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), | 335 | 32 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); | 336 | 32 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Line | Count | Source | 273 | 8 | static inline auto ArbitraryWebPConfig() { | 274 | 8 | return fuzztest::Map( | 275 | 8 | [](int lossless, int quality, int method, int image_hint, int segments, | 276 | 8 | int sns_strength, int filter_strength, int filter_sharpness, | 277 | 8 | int filter_type, int autofilter, int alpha_compression, | 278 | 8 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, | 279 | 8 | int partitions, int partition_limit, int emulate_jpeg_size, | 280 | 8 | int thread_level, int low_memory, int near_lossless, int exact, | 281 | 8 | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 282 | 8 | WebPConfig config; | 283 | 8 | if (!WebPConfigInit(&config)) assert(false); | 284 | 8 | config.lossless = lossless; | 285 | 8 | config.quality = quality; | 286 | 8 | config.method = method; | 287 | 8 | config.image_hint = (WebPImageHint)image_hint; | 288 | 8 | config.segments = segments; | 289 | 8 | config.sns_strength = sns_strength; | 290 | 8 | config.filter_strength = filter_strength; | 291 | 8 | config.filter_sharpness = filter_sharpness; | 292 | 8 | config.filter_type = filter_type; | 293 | 8 | config.autofilter = autofilter; | 294 | 8 | config.alpha_compression = alpha_compression; | 295 | 8 | config.alpha_filtering = alpha_filtering; | 296 | 8 | config.alpha_quality = alpha_quality; | 297 | 8 | config.pass = pass; | 298 | 8 | config.show_compressed = 1; | 299 | 8 | config.preprocessing = preprocessing; | 300 | 8 | config.partitions = partitions; | 301 | 8 | config.partition_limit = 10 * partition_limit; | 302 | 8 | config.emulate_jpeg_size = emulate_jpeg_size; | 303 | 8 | config.thread_level = thread_level; | 304 | 8 | config.low_memory = low_memory; | 305 | 8 | config.near_lossless = 20 * near_lossless; | 306 | 8 | config.exact = exact; | 307 | 8 | config.use_delta_palette = use_delta_palette; | 308 | 8 | config.use_sharp_yuv = use_sharp_yuv; | 309 | 8 | if (!WebPValidateConfig(&config)) assert(false); | 310 | 8 | return config; | 311 | 8 | }, | 312 | 8 | /*lossless=*/fuzztest::InRange<int>(0, 1), | 313 | 8 | /*quality=*/fuzztest::InRange<int>(0, 100), | 314 | 8 | /*method=*/fuzztest::InRange<int>(0, 6), | 315 | 8 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), | 316 | 8 | /*segments=*/fuzztest::InRange<int>(1, 4), | 317 | 8 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), | 318 | 8 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), | 319 | 8 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), | 320 | 8 | /*filter_type=*/fuzztest::InRange<int>(0, 1), | 321 | 8 | /*autofilter=*/fuzztest::InRange<int>(0, 1), | 322 | 8 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), | 323 | 8 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), | 324 | 8 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), | 325 | 8 | /*pass=*/fuzztest::InRange<int>(1, 10), | 326 | 8 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), | 327 | 8 | /*partitions=*/fuzztest::InRange<int>(0, 3), | 328 | 8 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), | 329 | 8 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), | 330 | 8 | /*thread_level=*/fuzztest::InRange<int>(0, 1), | 331 | 8 | /*low_memory=*/fuzztest::InRange<int>(0, 1), | 332 | 8 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), | 333 | 8 | /*exact=*/fuzztest::InRange<int>(0, 1), | 334 | 8 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), | 335 | 8 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); | 336 | 8 | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() enc_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Line | Count | Source | 273 | 2 | static inline auto ArbitraryWebPConfig() { | 274 | 2 | return fuzztest::Map( | 275 | 2 | [](int lossless, int quality, int method, int image_hint, int segments, | 276 | 2 | int sns_strength, int filter_strength, int filter_sharpness, | 277 | 2 | int filter_type, int autofilter, int alpha_compression, | 278 | 2 | int alpha_filtering, int alpha_quality, int pass, int preprocessing, | 279 | 2 | int partitions, int partition_limit, int emulate_jpeg_size, | 280 | 2 | int thread_level, int low_memory, int near_lossless, int exact, | 281 | 2 | int use_delta_palette, int use_sharp_yuv) -> WebPConfig { | 282 | 2 | WebPConfig config; | 283 | 2 | if (!WebPConfigInit(&config)) assert(false); | 284 | 2 | config.lossless = lossless; | 285 | 2 | config.quality = quality; | 286 | 2 | config.method = method; | 287 | 2 | config.image_hint = (WebPImageHint)image_hint; | 288 | 2 | config.segments = segments; | 289 | 2 | config.sns_strength = sns_strength; | 290 | 2 | config.filter_strength = filter_strength; | 291 | 2 | config.filter_sharpness = filter_sharpness; | 292 | 2 | config.filter_type = filter_type; | 293 | 2 | config.autofilter = autofilter; | 294 | 2 | config.alpha_compression = alpha_compression; | 295 | 2 | config.alpha_filtering = alpha_filtering; | 296 | 2 | config.alpha_quality = alpha_quality; | 297 | 2 | config.pass = pass; | 298 | 2 | config.show_compressed = 1; | 299 | 2 | config.preprocessing = preprocessing; | 300 | 2 | config.partitions = partitions; | 301 | 2 | config.partition_limit = 10 * partition_limit; | 302 | 2 | config.emulate_jpeg_size = emulate_jpeg_size; | 303 | 2 | config.thread_level = thread_level; | 304 | 2 | config.low_memory = low_memory; | 305 | 2 | config.near_lossless = 20 * near_lossless; | 306 | 2 | config.exact = exact; | 307 | 2 | config.use_delta_palette = use_delta_palette; | 308 | 2 | config.use_sharp_yuv = use_sharp_yuv; | 309 | 2 | if (!WebPValidateConfig(&config)) assert(false); | 310 | 2 | return config; | 311 | 2 | }, | 312 | 2 | /*lossless=*/fuzztest::InRange<int>(0, 1), | 313 | 2 | /*quality=*/fuzztest::InRange<int>(0, 100), | 314 | 2 | /*method=*/fuzztest::InRange<int>(0, 6), | 315 | 2 | /*image_hint=*/fuzztest::InRange<int>(0, WEBP_HINT_LAST - 1), | 316 | 2 | /*segments=*/fuzztest::InRange<int>(1, 4), | 317 | 2 | /*sns_strength=*/fuzztest::InRange<int>(0, 100), | 318 | 2 | /*filter_strength=*/fuzztest::InRange<int>(0, 100), | 319 | 2 | /*filter_sharpness=*/fuzztest::InRange<int>(0, 7), | 320 | 2 | /*filter_type=*/fuzztest::InRange<int>(0, 1), | 321 | 2 | /*autofilter=*/fuzztest::InRange<int>(0, 1), | 322 | 2 | /*alpha_compression=*/fuzztest::InRange<int>(0, 1), | 323 | 2 | /*alpha_filtering=*/fuzztest::InRange<int>(0, 2), | 324 | 2 | /*alpha_quality=*/fuzztest::InRange<int>(0, 100), | 325 | 2 | /*pass=*/fuzztest::InRange<int>(1, 10), | 326 | 2 | /*preprocessing=*/fuzztest::InRange<int>(0, 2), | 327 | 2 | /*partitions=*/fuzztest::InRange<int>(0, 3), | 328 | 2 | /*partition_limit=*/fuzztest::InRange<int>(0, 10), | 329 | 2 | /*emulate_jpeg_size=*/fuzztest::InRange<int>(0, 1), | 330 | 2 | /*thread_level=*/fuzztest::InRange<int>(0, 1), | 331 | 2 | /*low_memory=*/fuzztest::InRange<int>(0, 1), | 332 | 2 | /*near_lossless=*/fuzztest::InRange<int>(0, 5), | 333 | 2 | /*exact=*/fuzztest::InRange<int>(0, 1), | 334 | 2 | /*use_delta_palette=*/fuzztest::InRange<int>(0, 1), | 335 | 2 | /*use_sharp_yuv=*/fuzztest::InRange<int>(0, 1)); | 336 | 2 | } |
Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() Unexecuted instantiation: anim_util_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() Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig() |
337 | | |
338 | | // Like WebPDecoderOptions but with no C array. |
339 | | // This can be removed once b/294098900 is fixed. |
340 | | struct WebPDecoderOptionsCpp { |
341 | | int bypass_filtering; |
342 | | int no_fancy_upsampling; |
343 | | int use_cropping; |
344 | | int crop_left, crop_top; |
345 | | |
346 | | int crop_width, crop_height; |
347 | | int use_scaling; |
348 | | int scaled_width, scaled_height; |
349 | | |
350 | | int use_threads; |
351 | | int dithering_strength; |
352 | | int flip; |
353 | | int alpha_dithering_strength; |
354 | | |
355 | | std::array<uint32_t, 5> pad; |
356 | | }; |
357 | | |
358 | 22 | static inline auto ArbitraryValidWebPDecoderOptions() { |
359 | 22 | return fuzztest::Map( |
360 | 22 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, |
361 | 22 | int crop_left, int crop_top, int crop_width, int crop_height, |
362 | 22 | int use_scaling, int scaled_width, int scaled_height, int use_threads, |
363 | 22 | int dithering_strength, int flip, |
364 | 36.2k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { |
365 | 36.2k | WebPDecoderOptions options; |
366 | 36.2k | options.bypass_filtering = bypass_filtering; |
367 | 36.2k | options.no_fancy_upsampling = no_fancy_upsampling; |
368 | 36.2k | options.use_cropping = use_cropping; |
369 | 36.2k | options.crop_left = crop_left; |
370 | 36.2k | options.crop_top = crop_top; |
371 | 36.2k | options.crop_width = crop_width; |
372 | 36.2k | options.crop_height = crop_height; |
373 | 36.2k | options.use_scaling = use_scaling; |
374 | 36.2k | options.scaled_width = scaled_width; |
375 | 36.2k | options.scaled_height = scaled_height; |
376 | 36.2k | options.use_threads = use_threads; |
377 | 36.2k | options.dithering_strength = dithering_strength; |
378 | 36.2k | options.flip = flip; |
379 | 36.2k | options.alpha_dithering_strength = alpha_dithering_strength; |
380 | 36.2k | WebPDecoderConfig config; |
381 | 36.2k | if (!WebPInitDecoderConfig(&config)) assert(false); |
382 | 36.2k | config.options = options; |
383 | 36.2k | if (!WebPValidateDecoderConfig(&config)) assert(false); |
384 | 36.2k | WebPDecoderOptionsCpp options_cpp; |
385 | 36.2k | std::memcpy(&options_cpp, &options, sizeof(options)); |
386 | 36.2k | return options_cpp; |
387 | 36.2k | }, 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 | 364 | 23.8k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 365 | 23.8k | WebPDecoderOptions options; | 366 | 23.8k | options.bypass_filtering = bypass_filtering; | 367 | 23.8k | options.no_fancy_upsampling = no_fancy_upsampling; | 368 | 23.8k | options.use_cropping = use_cropping; | 369 | 23.8k | options.crop_left = crop_left; | 370 | 23.8k | options.crop_top = crop_top; | 371 | 23.8k | options.crop_width = crop_width; | 372 | 23.8k | options.crop_height = crop_height; | 373 | 23.8k | options.use_scaling = use_scaling; | 374 | 23.8k | options.scaled_width = scaled_width; | 375 | 23.8k | options.scaled_height = scaled_height; | 376 | 23.8k | options.use_threads = use_threads; | 377 | 23.8k | options.dithering_strength = dithering_strength; | 378 | 23.8k | options.flip = flip; | 379 | 23.8k | options.alpha_dithering_strength = alpha_dithering_strength; | 380 | 23.8k | WebPDecoderConfig config; | 381 | 23.8k | if (!WebPInitDecoderConfig(&config)) assert(false); | 382 | 23.8k | config.options = options; | 383 | 23.8k | if (!WebPValidateDecoderConfig(&config)) assert(false); | 384 | 23.8k | WebPDecoderOptionsCpp options_cpp; | 385 | 23.8k | std::memcpy(&options_cpp, &options, sizeof(options)); | 386 | 23.8k | return options_cpp; | 387 | 23.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 | 364 | 4.76k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 365 | 4.76k | WebPDecoderOptions options; | 366 | 4.76k | options.bypass_filtering = bypass_filtering; | 367 | 4.76k | options.no_fancy_upsampling = no_fancy_upsampling; | 368 | 4.76k | options.use_cropping = use_cropping; | 369 | 4.76k | options.crop_left = crop_left; | 370 | 4.76k | options.crop_top = crop_top; | 371 | 4.76k | options.crop_width = crop_width; | 372 | 4.76k | options.crop_height = crop_height; | 373 | 4.76k | options.use_scaling = use_scaling; | 374 | 4.76k | options.scaled_width = scaled_width; | 375 | 4.76k | options.scaled_height = scaled_height; | 376 | 4.76k | options.use_threads = use_threads; | 377 | 4.76k | options.dithering_strength = dithering_strength; | 378 | 4.76k | options.flip = flip; | 379 | 4.76k | options.alpha_dithering_strength = alpha_dithering_strength; | 380 | 4.76k | WebPDecoderConfig config; | 381 | 4.76k | if (!WebPInitDecoderConfig(&config)) assert(false); | 382 | 4.76k | config.options = options; | 383 | 4.76k | if (!WebPValidateDecoderConfig(&config)) assert(false); | 384 | 4.76k | WebPDecoderOptionsCpp options_cpp; | 385 | 4.76k | std::memcpy(&options_cpp, &options, sizeof(options)); | 386 | 4.76k | return options_cpp; | 387 | 4.76k | }, |
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 | 364 | 7.58k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 365 | 7.58k | WebPDecoderOptions options; | 366 | 7.58k | options.bypass_filtering = bypass_filtering; | 367 | 7.58k | options.no_fancy_upsampling = no_fancy_upsampling; | 368 | 7.58k | options.use_cropping = use_cropping; | 369 | 7.58k | options.crop_left = crop_left; | 370 | 7.58k | options.crop_top = crop_top; | 371 | 7.58k | options.crop_width = crop_width; | 372 | 7.58k | options.crop_height = crop_height; | 373 | 7.58k | options.use_scaling = use_scaling; | 374 | 7.58k | options.scaled_width = scaled_width; | 375 | 7.58k | options.scaled_height = scaled_height; | 376 | 7.58k | options.use_threads = use_threads; | 377 | 7.58k | options.dithering_strength = dithering_strength; | 378 | 7.58k | options.flip = flip; | 379 | 7.58k | options.alpha_dithering_strength = alpha_dithering_strength; | 380 | 7.58k | WebPDecoderConfig config; | 381 | 7.58k | if (!WebPInitDecoderConfig(&config)) assert(false); | 382 | 7.58k | config.options = options; | 383 | 7.58k | if (!WebPValidateDecoderConfig(&config)) assert(false); | 384 | 7.58k | WebPDecoderOptionsCpp options_cpp; | 385 | 7.58k | std::memcpy(&options_cpp, &options, sizeof(options)); | 386 | 7.58k | return options_cpp; | 387 | 7.58k | }, |
|
388 | 22 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), |
389 | 22 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), |
390 | 22 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), |
391 | 22 | /*crop_left=*/fuzztest::InRange<int>(0, 10), |
392 | 22 | /*crop_top=*/fuzztest::InRange<int>(0, 10), |
393 | 22 | /*crop_width=*/fuzztest::InRange<int>(1, 10), |
394 | 22 | /*crop_height=*/fuzztest::InRange<int>(1, 10), |
395 | 22 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), |
396 | 22 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), |
397 | 22 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), |
398 | 22 | /*use_threads=*/fuzztest::InRange<int>(0, 1), |
399 | 22 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), |
400 | 22 | /*flip=*/fuzztest::InRange<int>(0, 1), |
401 | 22 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); |
402 | 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 | 358 | 16 | static inline auto ArbitraryValidWebPDecoderOptions() { | 359 | 16 | return fuzztest::Map( | 360 | 16 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 361 | 16 | int crop_left, int crop_top, int crop_width, int crop_height, | 362 | 16 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 363 | 16 | int dithering_strength, int flip, | 364 | 16 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 365 | 16 | WebPDecoderOptions options; | 366 | 16 | options.bypass_filtering = bypass_filtering; | 367 | 16 | options.no_fancy_upsampling = no_fancy_upsampling; | 368 | 16 | options.use_cropping = use_cropping; | 369 | 16 | options.crop_left = crop_left; | 370 | 16 | options.crop_top = crop_top; | 371 | 16 | options.crop_width = crop_width; | 372 | 16 | options.crop_height = crop_height; | 373 | 16 | options.use_scaling = use_scaling; | 374 | 16 | options.scaled_width = scaled_width; | 375 | 16 | options.scaled_height = scaled_height; | 376 | 16 | options.use_threads = use_threads; | 377 | 16 | options.dithering_strength = dithering_strength; | 378 | 16 | options.flip = flip; | 379 | 16 | options.alpha_dithering_strength = alpha_dithering_strength; | 380 | 16 | WebPDecoderConfig config; | 381 | 16 | if (!WebPInitDecoderConfig(&config)) assert(false); | 382 | 16 | config.options = options; | 383 | 16 | if (!WebPValidateDecoderConfig(&config)) assert(false); | 384 | 16 | WebPDecoderOptionsCpp options_cpp; | 385 | 16 | std::memcpy(&options_cpp, &options, sizeof(options)); | 386 | 16 | return options_cpp; | 387 | 16 | }, | 388 | 16 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), | 389 | 16 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), | 390 | 16 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), | 391 | 16 | /*crop_left=*/fuzztest::InRange<int>(0, 10), | 392 | 16 | /*crop_top=*/fuzztest::InRange<int>(0, 10), | 393 | 16 | /*crop_width=*/fuzztest::InRange<int>(1, 10), | 394 | 16 | /*crop_height=*/fuzztest::InRange<int>(1, 10), | 395 | 16 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), | 396 | 16 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), | 397 | 16 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), | 398 | 16 | /*use_threads=*/fuzztest::InRange<int>(0, 1), | 399 | 16 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), | 400 | 16 | /*flip=*/fuzztest::InRange<int>(0, 1), | 401 | 16 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); | 402 | 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: anim_util_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: animation_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() dec_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Line | Count | Source | 358 | 4 | static inline auto ArbitraryValidWebPDecoderOptions() { | 359 | 4 | return fuzztest::Map( | 360 | 4 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 361 | 4 | int crop_left, int crop_top, int crop_width, int crop_height, | 362 | 4 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 363 | 4 | int dithering_strength, int flip, | 364 | 4 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 365 | 4 | WebPDecoderOptions options; | 366 | 4 | options.bypass_filtering = bypass_filtering; | 367 | 4 | options.no_fancy_upsampling = no_fancy_upsampling; | 368 | 4 | options.use_cropping = use_cropping; | 369 | 4 | options.crop_left = crop_left; | 370 | 4 | options.crop_top = crop_top; | 371 | 4 | options.crop_width = crop_width; | 372 | 4 | options.crop_height = crop_height; | 373 | 4 | options.use_scaling = use_scaling; | 374 | 4 | options.scaled_width = scaled_width; | 375 | 4 | options.scaled_height = scaled_height; | 376 | 4 | options.use_threads = use_threads; | 377 | 4 | options.dithering_strength = dithering_strength; | 378 | 4 | options.flip = flip; | 379 | 4 | options.alpha_dithering_strength = alpha_dithering_strength; | 380 | 4 | WebPDecoderConfig config; | 381 | 4 | if (!WebPInitDecoderConfig(&config)) assert(false); | 382 | 4 | config.options = options; | 383 | 4 | if (!WebPValidateDecoderConfig(&config)) assert(false); | 384 | 4 | WebPDecoderOptionsCpp options_cpp; | 385 | 4 | std::memcpy(&options_cpp, &options, sizeof(options)); | 386 | 4 | return options_cpp; | 387 | 4 | }, | 388 | 4 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), | 389 | 4 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), | 390 | 4 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), | 391 | 4 | /*crop_left=*/fuzztest::InRange<int>(0, 10), | 392 | 4 | /*crop_top=*/fuzztest::InRange<int>(0, 10), | 393 | 4 | /*crop_width=*/fuzztest::InRange<int>(1, 10), | 394 | 4 | /*crop_height=*/fuzztest::InRange<int>(1, 10), | 395 | 4 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), | 396 | 4 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), | 397 | 4 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), | 398 | 4 | /*use_threads=*/fuzztest::InRange<int>(0, 1), | 399 | 4 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), | 400 | 4 | /*flip=*/fuzztest::InRange<int>(0, 1), | 401 | 4 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); | 402 | 4 | } |
advanced_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Line | Count | Source | 358 | 2 | static inline auto ArbitraryValidWebPDecoderOptions() { | 359 | 2 | return fuzztest::Map( | 360 | 2 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 361 | 2 | int crop_left, int crop_top, int crop_width, int crop_height, | 362 | 2 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 363 | 2 | int dithering_strength, int flip, | 364 | 2 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 365 | 2 | WebPDecoderOptions options; | 366 | 2 | options.bypass_filtering = bypass_filtering; | 367 | 2 | options.no_fancy_upsampling = no_fancy_upsampling; | 368 | 2 | options.use_cropping = use_cropping; | 369 | 2 | options.crop_left = crop_left; | 370 | 2 | options.crop_top = crop_top; | 371 | 2 | options.crop_width = crop_width; | 372 | 2 | options.crop_height = crop_height; | 373 | 2 | options.use_scaling = use_scaling; | 374 | 2 | options.scaled_width = scaled_width; | 375 | 2 | options.scaled_height = scaled_height; | 376 | 2 | options.use_threads = use_threads; | 377 | 2 | options.dithering_strength = dithering_strength; | 378 | 2 | options.flip = flip; | 379 | 2 | options.alpha_dithering_strength = alpha_dithering_strength; | 380 | 2 | WebPDecoderConfig config; | 381 | 2 | if (!WebPInitDecoderConfig(&config)) assert(false); | 382 | 2 | config.options = options; | 383 | 2 | if (!WebPValidateDecoderConfig(&config)) assert(false); | 384 | 2 | WebPDecoderOptionsCpp options_cpp; | 385 | 2 | std::memcpy(&options_cpp, &options, sizeof(options)); | 386 | 2 | return options_cpp; | 387 | 2 | }, | 388 | 2 | /*bypass_filtering=*/fuzztest::InRange<int>(0, 1), | 389 | 2 | /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1), | 390 | 2 | /*use_cropping=*/fuzztest::InRange<int>(0, 1), | 391 | 2 | /*crop_left=*/fuzztest::InRange<int>(0, 10), | 392 | 2 | /*crop_top=*/fuzztest::InRange<int>(0, 10), | 393 | 2 | /*crop_width=*/fuzztest::InRange<int>(1, 10), | 394 | 2 | /*crop_height=*/fuzztest::InRange<int>(1, 10), | 395 | 2 | /*use_scaling=*/fuzztest::InRange<int>(0, 1), | 396 | 2 | /*scaled_width=*/fuzztest::InRange<int>(1, 10), | 397 | 2 | /*scaled_height=*/fuzztest::InRange<int>(1, 10), | 398 | 2 | /*use_threads=*/fuzztest::InRange<int>(0, 1), | 399 | 2 | /*dithering_strength=*/fuzztest::InRange<int>(0, 100), | 400 | 2 | /*flip=*/fuzztest::InRange<int>(0, 1), | 401 | 2 | /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100)); | 402 | 2 | } |
Unexecuted instantiation: simple_api_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::ArbitraryValidWebPDecoderOptions() |
403 | | |
404 | 16 | static inline auto ArbitraryWebPDecoderOptions() { |
405 | 16 | return fuzztest::Map( |
406 | 16 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, |
407 | 16 | int crop_left, int crop_top, int crop_width, int crop_height, |
408 | 16 | int use_scaling, int scaled_width, int scaled_height, int use_threads, |
409 | 16 | int dithering_strength, int flip, |
410 | 24.4k | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { |
411 | 24.4k | WebPDecoderOptions options; |
412 | 24.4k | options.bypass_filtering = bypass_filtering; |
413 | 24.4k | options.no_fancy_upsampling = no_fancy_upsampling; |
414 | 24.4k | options.use_cropping = use_cropping; |
415 | 24.4k | options.crop_left = crop_left; |
416 | 24.4k | options.crop_top = crop_top; |
417 | 24.4k | options.crop_width = crop_width; |
418 | 24.4k | options.crop_height = crop_height; |
419 | 24.4k | options.use_scaling = use_scaling; |
420 | 24.4k | options.scaled_width = scaled_width; |
421 | 24.4k | options.scaled_height = scaled_height; |
422 | 24.4k | options.use_threads = use_threads; |
423 | 24.4k | options.dithering_strength = dithering_strength; |
424 | 24.4k | options.flip = flip; |
425 | 24.4k | options.alpha_dithering_strength = alpha_dithering_strength; |
426 | 24.4k | WebPDecoderOptionsCpp options_cpp; |
427 | 24.4k | std::memcpy(&options_cpp, &options, sizeof(options)); |
428 | 24.4k | return options_cpp; |
429 | 24.4k | }, |
430 | 16 | /*bypass_filtering=*/fuzztest::Arbitrary<int>(), |
431 | 16 | /*no_fancy_upsampling=*/fuzztest::Arbitrary<int>(), |
432 | 16 | /*use_cropping=*/fuzztest::Arbitrary<int>(), |
433 | 16 | /*crop_left=*/fuzztest::Arbitrary<int>(), |
434 | 16 | /*crop_top=*/fuzztest::Arbitrary<int>(), |
435 | 16 | /*crop_width=*/fuzztest::Arbitrary<int>(), |
436 | 16 | /*crop_height=*/fuzztest::Arbitrary<int>(), |
437 | 16 | /*use_scaling=*/fuzztest::Arbitrary<int>(), |
438 | 16 | /*scaled_width=*/fuzztest::Arbitrary<int>(), |
439 | 16 | /*scaled_height=*/fuzztest::Arbitrary<int>(), |
440 | 16 | /*use_threads=*/fuzztest::Arbitrary<int>(), |
441 | 16 | /*dithering_strength=*/fuzztest::Arbitrary<int>(), |
442 | 16 | /*flip=*/fuzztest::Arbitrary<int>(), |
443 | 16 | /*alpha_dithering_strength=*/fuzztest::Arbitrary<int>()); |
444 | 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 | 404 | 16 | static inline auto ArbitraryWebPDecoderOptions() { | 405 | 16 | return fuzztest::Map( | 406 | 16 | [](int bypass_filtering, int no_fancy_upsampling, int use_cropping, | 407 | 16 | int crop_left, int crop_top, int crop_width, int crop_height, | 408 | 16 | int use_scaling, int scaled_width, int scaled_height, int use_threads, | 409 | 16 | int dithering_strength, int flip, | 410 | 16 | int alpha_dithering_strength) -> WebPDecoderOptionsCpp { | 411 | 16 | WebPDecoderOptions options; | 412 | 16 | options.bypass_filtering = bypass_filtering; | 413 | 16 | options.no_fancy_upsampling = no_fancy_upsampling; | 414 | 16 | options.use_cropping = use_cropping; | 415 | 16 | options.crop_left = crop_left; | 416 | 16 | options.crop_top = crop_top; | 417 | 16 | options.crop_width = crop_width; | 418 | 16 | options.crop_height = crop_height; | 419 | 16 | options.use_scaling = use_scaling; | 420 | 16 | options.scaled_width = scaled_width; | 421 | 16 | options.scaled_height = scaled_height; | 422 | 16 | options.use_threads = use_threads; | 423 | 16 | options.dithering_strength = dithering_strength; | 424 | 16 | options.flip = flip; | 425 | 16 | options.alpha_dithering_strength = alpha_dithering_strength; | 426 | 16 | WebPDecoderOptionsCpp options_cpp; | 427 | 16 | std::memcpy(&options_cpp, &options, sizeof(options)); | 428 | 16 | return options_cpp; | 429 | 16 | }, | 430 | 16 | /*bypass_filtering=*/fuzztest::Arbitrary<int>(), | 431 | 16 | /*no_fancy_upsampling=*/fuzztest::Arbitrary<int>(), | 432 | 16 | /*use_cropping=*/fuzztest::Arbitrary<int>(), | 433 | 16 | /*crop_left=*/fuzztest::Arbitrary<int>(), | 434 | 16 | /*crop_top=*/fuzztest::Arbitrary<int>(), | 435 | 16 | /*crop_width=*/fuzztest::Arbitrary<int>(), | 436 | 16 | /*crop_height=*/fuzztest::Arbitrary<int>(), | 437 | 16 | /*use_scaling=*/fuzztest::Arbitrary<int>(), | 438 | 16 | /*scaled_width=*/fuzztest::Arbitrary<int>(), | 439 | 16 | /*scaled_height=*/fuzztest::Arbitrary<int>(), | 440 | 16 | /*use_threads=*/fuzztest::Arbitrary<int>(), | 441 | 16 | /*dithering_strength=*/fuzztest::Arbitrary<int>(), | 442 | 16 | /*flip=*/fuzztest::Arbitrary<int>(), | 443 | 16 | /*alpha_dithering_strength=*/fuzztest::Arbitrary<int>()); | 444 | 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: anim_util_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() Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::ArbitraryWebPDecoderOptions() |
445 | | |
446 | | struct CropOrScaleParams { |
447 | | bool alter_input; |
448 | | bool crop_or_scale; |
449 | | int width_ratio; |
450 | | int height_ratio; |
451 | | int left_ratio; |
452 | | int top_ratio; |
453 | | }; |
454 | | |
455 | 42 | static inline auto ArbitraryCropOrScaleParams() { |
456 | 42 | return fuzztest::Map( |
457 | 42 | [](const std::optional<std::pair<int, int>>& width_height_ratio, |
458 | 42 | const std::optional<std::pair<int, int>>& left_top_ratio) |
459 | 85.1k | -> CropOrScaleParams { |
460 | 85.1k | CropOrScaleParams params; |
461 | 85.1k | params.alter_input = width_height_ratio.has_value(); |
462 | 85.1k | if (params.alter_input) { |
463 | 38.4k | params.width_ratio = width_height_ratio->first; |
464 | 38.4k | params.height_ratio = width_height_ratio->second; |
465 | 38.4k | params.crop_or_scale = left_top_ratio.has_value(); |
466 | 38.4k | if (params.crop_or_scale) { |
467 | 10.6k | params.left_ratio = left_top_ratio->first; |
468 | 10.6k | params.top_ratio = left_top_ratio->second; |
469 | 10.6k | } |
470 | 38.4k | } |
471 | 85.1k | return params; |
472 | 85.1k | }, 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 | 459 | 48.3k | -> CropOrScaleParams { | 460 | 48.3k | CropOrScaleParams params; | 461 | 48.3k | params.alter_input = width_height_ratio.has_value(); | 462 | 48.3k | if (params.alter_input) { | 463 | 19.7k | params.width_ratio = width_height_ratio->first; | 464 | 19.7k | params.height_ratio = width_height_ratio->second; | 465 | 19.7k | params.crop_or_scale = left_top_ratio.has_value(); | 466 | 19.7k | if (params.crop_or_scale) { | 467 | 3.86k | params.left_ratio = left_top_ratio->first; | 468 | 3.86k | params.top_ratio = left_top_ratio->second; | 469 | 3.86k | } | 470 | 19.7k | } | 471 | 48.3k | return params; | 472 | 48.3k | }, |
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 | 459 | 24.0k | -> CropOrScaleParams { | 460 | 24.0k | CropOrScaleParams params; | 461 | 24.0k | params.alter_input = width_height_ratio.has_value(); | 462 | 24.0k | if (params.alter_input) { | 463 | 12.6k | params.width_ratio = width_height_ratio->first; | 464 | 12.6k | params.height_ratio = width_height_ratio->second; | 465 | 12.6k | params.crop_or_scale = left_top_ratio.has_value(); | 466 | 12.6k | if (params.crop_or_scale) { | 467 | 5.81k | params.left_ratio = left_top_ratio->first; | 468 | 5.81k | params.top_ratio = left_top_ratio->second; | 469 | 5.81k | } | 470 | 12.6k | } | 471 | 24.0k | return params; | 472 | 24.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 | 459 | 12.7k | -> CropOrScaleParams { | 460 | 12.7k | CropOrScaleParams params; | 461 | 12.7k | params.alter_input = width_height_ratio.has_value(); | 462 | 12.7k | if (params.alter_input) { | 463 | 5.97k | params.width_ratio = width_height_ratio->first; | 464 | 5.97k | params.height_ratio = width_height_ratio->second; | 465 | 5.97k | params.crop_or_scale = left_top_ratio.has_value(); | 466 | 5.97k | if (params.crop_or_scale) { | 467 | 952 | params.left_ratio = left_top_ratio->first; | 468 | 952 | params.top_ratio = left_top_ratio->second; | 469 | 952 | } | 470 | 5.97k | } | 471 | 12.7k | return params; | 472 | 12.7k | }, |
|
473 | 42 | fuzztest::OptionalOf( |
474 | 42 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), |
475 | 42 | fuzztest::OptionalOf( |
476 | 42 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); |
477 | 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 | 455 | 32 | static inline auto ArbitraryCropOrScaleParams() { | 456 | 32 | return fuzztest::Map( | 457 | 32 | [](const std::optional<std::pair<int, int>>& width_height_ratio, | 458 | 32 | const std::optional<std::pair<int, int>>& left_top_ratio) | 459 | 32 | -> CropOrScaleParams { | 460 | 32 | CropOrScaleParams params; | 461 | 32 | params.alter_input = width_height_ratio.has_value(); | 462 | 32 | if (params.alter_input) { | 463 | 32 | params.width_ratio = width_height_ratio->first; | 464 | 32 | params.height_ratio = width_height_ratio->second; | 465 | 32 | params.crop_or_scale = left_top_ratio.has_value(); | 466 | 32 | if (params.crop_or_scale) { | 467 | 32 | params.left_ratio = left_top_ratio->first; | 468 | 32 | params.top_ratio = left_top_ratio->second; | 469 | 32 | } | 470 | 32 | } | 471 | 32 | return params; | 472 | 32 | }, | 473 | 32 | fuzztest::OptionalOf( | 474 | 32 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), | 475 | 32 | fuzztest::OptionalOf( | 476 | 32 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); | 477 | 32 | } |
animencoder_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Line | Count | Source | 455 | 8 | static inline auto ArbitraryCropOrScaleParams() { | 456 | 8 | return fuzztest::Map( | 457 | 8 | [](const std::optional<std::pair<int, int>>& width_height_ratio, | 458 | 8 | const std::optional<std::pair<int, int>>& left_top_ratio) | 459 | 8 | -> CropOrScaleParams { | 460 | 8 | CropOrScaleParams params; | 461 | 8 | params.alter_input = width_height_ratio.has_value(); | 462 | 8 | if (params.alter_input) { | 463 | 8 | params.width_ratio = width_height_ratio->first; | 464 | 8 | params.height_ratio = width_height_ratio->second; | 465 | 8 | params.crop_or_scale = left_top_ratio.has_value(); | 466 | 8 | if (params.crop_or_scale) { | 467 | 8 | params.left_ratio = left_top_ratio->first; | 468 | 8 | params.top_ratio = left_top_ratio->second; | 469 | 8 | } | 470 | 8 | } | 471 | 8 | return params; | 472 | 8 | }, | 473 | 8 | fuzztest::OptionalOf( | 474 | 8 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), | 475 | 8 | fuzztest::OptionalOf( | 476 | 8 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); | 477 | 8 | } |
Unexecuted instantiation: webp_info_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() enc_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Line | Count | Source | 455 | 2 | static inline auto ArbitraryCropOrScaleParams() { | 456 | 2 | return fuzztest::Map( | 457 | 2 | [](const std::optional<std::pair<int, int>>& width_height_ratio, | 458 | 2 | const std::optional<std::pair<int, int>>& left_top_ratio) | 459 | 2 | -> CropOrScaleParams { | 460 | 2 | CropOrScaleParams params; | 461 | 2 | params.alter_input = width_height_ratio.has_value(); | 462 | 2 | if (params.alter_input) { | 463 | 2 | params.width_ratio = width_height_ratio->first; | 464 | 2 | params.height_ratio = width_height_ratio->second; | 465 | 2 | params.crop_or_scale = left_top_ratio.has_value(); | 466 | 2 | if (params.crop_or_scale) { | 467 | 2 | params.left_ratio = left_top_ratio->first; | 468 | 2 | params.top_ratio = left_top_ratio->second; | 469 | 2 | } | 470 | 2 | } | 471 | 2 | return params; | 472 | 2 | }, | 473 | 2 | fuzztest::OptionalOf( | 474 | 2 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8))), | 475 | 2 | fuzztest::OptionalOf( | 476 | 2 | fuzztest::PairOf(fuzztest::InRange(1, 8), fuzztest::InRange(1, 8)))); | 477 | 2 | } |
Unexecuted instantiation: animdecoder_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() Unexecuted instantiation: anim_util_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() Unexecuted instantiation: sharpyuv_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams() |
478 | | |
479 | | // Crops or scales a picture according to the given params. |
480 | | int CropOrScale(WebPPicture* pic, const CropOrScaleParams& params); |
481 | | |
482 | | // Imposes a level of optimization among one of the kMaxOptimizationIndex+1 |
483 | | // possible values: OnlyC, ForceSlowSSSE3, NoSSE41, NoAVX, default. |
484 | | static constexpr uint32_t kMaxOptimizationIndex = 4; |
485 | | void SetOptimization(VP8CPUInfo default_VP8GetCPUInfo, uint32_t index); |
486 | | |
487 | | //------------------------------------------------------------------------------ |
488 | | |
489 | | // See https://developers.google.com/speed/webp/docs/riff_container. |
490 | | static constexpr size_t kMaxWebPFileSize = (1ull << 32) - 2; // 4 GiB - 2 |
491 | | |
492 | | std::vector<std::string> GetDictionaryFromFiles( |
493 | | const std::vector<std::string_view>& file_paths); |
494 | | |
495 | | // Checks whether the binary blob containing a JPEG or WebP is too big for the |
496 | | // fuzzer. |
497 | | bool IsImageTooBig(const uint8_t* data, size_t size); |
498 | | |
499 | | } // namespace fuzz_utils |
500 | | |
501 | | #endif // WEBP_TESTS_FUZZER_FUZZ_UTILS_H_ |