Coverage Report

Created: 2026-05-30 06:22

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