Coverage Report

Created: 2026-08-31 06:51

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
12.6k
static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) {
65
12.6k
  uint8_t value = 0;
66
12.6k
  size_t incr = size / 128;
67
12.6k
  if (!incr) incr = 1;
68
553k
  for (size_t i = 0; i < size; i += incr) value += data[i];
69
12.6k
  return value;
70
12.6k
}
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
7.87k
static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) {
65
7.87k
  uint8_t value = 0;
66
7.87k
  size_t incr = size / 128;
67
7.87k
  if (!incr) incr = 1;
68
359k
  for (size_t i = 0; i < size; i += incr) value += data[i];
69
7.87k
  return value;
70
7.87k
}
simple_api_fuzzer.cc:fuzz_utils::FuzzHash(unsigned char const*, unsigned long)
Line
Count
Source
64
4.73k
static WEBP_INLINE uint8_t FuzzHash(const uint8_t* const data, size_t size) {
65
4.73k
  uint8_t value = 0;
66
4.73k
  size_t incr = size / 128;
67
4.73k
  if (!incr) incr = 1;
68
193k
  for (size_t i = 0; i < size; i += incr) value += data[i];
69
4.73k
  return value;
70
4.73k
}
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
53.7k
  void operator()(WebPMemoryWriter* writer) const {
90
53.7k
    WebPMemoryWriterClear(writer);
91
53.7k
  }
92
0
  void operator()(WebPPicture* pic) const { WebPPictureFree(pic); }
93
53.7k
  void operator()(WebPDecoderConfig* config) const {
94
53.7k
    WebPFreeDecBuffer(&config->output);
95
53.7k
  }
96
};
97
98
// Like WebPPicture but with no C array.
99
// This can be removed once b/294098900 is fixed.
100
struct WebPPictureCpp {
101
  inline WebPPictureCpp(int use_argb, WebPEncCSP colorspace, int width,
102
                        int height, uint8_t* y, uint8_t* u, uint8_t* v,
103
                        int y_stride, int uv_stride, uint8_t* a, int a_stride,
104
                        uint32_t* argb, int argb_stride, void* memory,
105
104k
                        void* memory_argb) {
106
104k
    pic.reset(new WebPPicture(), [](WebPPicture* pic) {
107
104k
      WebPPictureFree(pic);
108
104k
      delete pic;
109
104k
    });
110
104k
    if (!WebPPictureInit(pic.get())) assert(false);
111
104k
    pic->use_argb = use_argb;
112
104k
    pic->colorspace = colorspace;
113
104k
    pic->width = width;
114
104k
    pic->height = height;
115
104k
    pic->y = y;
116
104k
    pic->u = u;
117
104k
    pic->v = v;
118
104k
    pic->a = a;
119
104k
    pic->y_stride = y_stride;
120
104k
    pic->uv_stride = uv_stride;
121
104k
    pic->a_stride = a_stride;
122
104k
    pic->argb = argb;
123
104k
    pic->argb_stride = argb_stride;
124
104k
    pic->memory_ = memory;
125
104k
    pic->memory_argb_ = memory_argb;
126
104k
  }
127
104k
  WebPPicture& ref() const { return const_cast<WebPPicture&>(*pic); }
128
  std::shared_ptr<WebPPicture> pic;
129
};
130
131
22
static inline auto ArbitraryWebPPicture() {
132
22
  return fuzztest::FlatMap(
133
      // colorspace of 0 is use_argb, 1 is YUV420, 2 is YUV420A.
134
235k
      [](int colorspace, int width, int height) {
135
235k
        const int uv_width = (int)(((int64_t)width + 1) >> 1);
136
235k
        const int uv_height = (int)(((int64_t)height + 1) >> 1);
137
        // Create a domain for the vector that strictly obeys w * h * 4.
138
235k
        size_t size = width * height;
139
235k
        if (colorspace == 0) size *= 4;
140
235k
        if (colorspace == 1) size += 2 * uv_width * uv_height;
141
235k
        if (colorspace == 2) size += 2 * uv_width * uv_height + size;
142
235k
        auto DataDomain =
143
235k
            fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size);
144
145
        // Map the vector domain back into our Image struct, injecting w and h
146
235k
        return fuzztest::Map(
147
235k
            [colorspace, width,
148
235k
             height](const std::vector<uint8_t>& data) -> WebPPictureCpp {
149
78.2k
              WebPPicture pic;
150
78.2k
              if (!WebPPictureInit(&pic)) assert(false);
151
78.2k
              pic.use_argb = colorspace == 0 ? 1 : 0;
152
78.2k
              pic.colorspace = static_cast<WebPEncCSP>(
153
78.2k
                  colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A);
154
78.2k
              pic.width = width;
155
78.2k
              pic.height = height;
156
78.2k
              if (!WebPPictureAlloc(&pic)) assert(false);
157
78.2k
              size_t size = width * height;
158
78.2k
              if (pic.use_argb) {
159
7.59k
                std::copy(data.begin(), data.begin() + size,
160
7.59k
                          (uint32_t*)pic.argb);
161
70.6k
              } else {
162
                // Y.
163
70.6k
                auto iter = data.begin();
164
70.6k
                std::copy(iter, iter + size, (uint8_t*)pic.y);
165
70.6k
                iter += size;
166
                // A.
167
70.6k
                if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) {
168
26.5k
                  std::copy(iter, iter + size, (uint8_t*)pic.a);
169
26.5k
                  iter += size;
170
26.5k
                }
171
                // U and V.
172
70.6k
                const int uv_width = (int)(((int64_t)width + 1) >> 1);
173
70.6k
                const int uv_height = (int)(((int64_t)height + 1) >> 1);
174
70.6k
                size = uv_width * uv_height;
175
70.6k
                std::copy(iter, iter + size, (uint8_t*)pic.u);
176
70.6k
                iter += size;
177
70.6k
                std::copy(iter, iter + size, (uint8_t*)pic.v);
178
70.6k
              }
179
78.2k
              return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width,
180
78.2k
                                    pic.height, pic.y, pic.u, pic.v,
181
78.2k
                                    pic.y_stride, pic.uv_stride, pic.a,
182
78.2k
                                    pic.a_stride, pic.argb, pic.argb_stride,
183
78.2k
                                    pic.memory_, pic.memory_argb_);
184
78.2k
            },
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
40.5k
             height](const std::vector<uint8_t>& data) -> WebPPictureCpp {
149
40.5k
              WebPPicture pic;
150
40.5k
              if (!WebPPictureInit(&pic)) assert(false);
151
40.5k
              pic.use_argb = colorspace == 0 ? 1 : 0;
152
40.5k
              pic.colorspace = static_cast<WebPEncCSP>(
153
40.5k
                  colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A);
154
40.5k
              pic.width = width;
155
40.5k
              pic.height = height;
156
40.5k
              if (!WebPPictureAlloc(&pic)) assert(false);
157
40.5k
              size_t size = width * height;
158
40.5k
              if (pic.use_argb) {
159
3.39k
                std::copy(data.begin(), data.begin() + size,
160
3.39k
                          (uint32_t*)pic.argb);
161
37.1k
              } else {
162
                // Y.
163
37.1k
                auto iter = data.begin();
164
37.1k
                std::copy(iter, iter + size, (uint8_t*)pic.y);
165
37.1k
                iter += size;
166
                // A.
167
37.1k
                if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) {
168
9.68k
                  std::copy(iter, iter + size, (uint8_t*)pic.a);
169
9.68k
                  iter += size;
170
9.68k
                }
171
                // U and V.
172
37.1k
                const int uv_width = (int)(((int64_t)width + 1) >> 1);
173
37.1k
                const int uv_height = (int)(((int64_t)height + 1) >> 1);
174
37.1k
                size = uv_width * uv_height;
175
37.1k
                std::copy(iter, iter + size, (uint8_t*)pic.u);
176
37.1k
                iter += size;
177
37.1k
                std::copy(iter, iter + size, (uint8_t*)pic.v);
178
37.1k
              }
179
40.5k
              return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width,
180
40.5k
                                    pic.height, pic.y, pic.u, pic.v,
181
40.5k
                                    pic.y_stride, pic.uv_stride, pic.a,
182
40.5k
                                    pic.a_stride, pic.argb, pic.argb_stride,
183
40.5k
                                    pic.memory_, pic.memory_argb_);
184
40.5k
            },
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) const::{lambda(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const&)#1}::operator()(std::__1::vector<unsigned char, {lambda(int, int, int)#1}::allocator<unsigned char> > const) const
Line
Count
Source
148
23.6k
             height](const std::vector<uint8_t>& data) -> WebPPictureCpp {
149
23.6k
              WebPPicture pic;
150
23.6k
              if (!WebPPictureInit(&pic)) assert(false);
151
23.6k
              pic.use_argb = colorspace == 0 ? 1 : 0;
152
23.6k
              pic.colorspace = static_cast<WebPEncCSP>(
153
23.6k
                  colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A);
154
23.6k
              pic.width = width;
155
23.6k
              pic.height = height;
156
23.6k
              if (!WebPPictureAlloc(&pic)) assert(false);
157
23.6k
              size_t size = width * height;
158
23.6k
              if (pic.use_argb) {
159
2.29k
                std::copy(data.begin(), data.begin() + size,
160
2.29k
                          (uint32_t*)pic.argb);
161
21.3k
              } else {
162
                // Y.
163
21.3k
                auto iter = data.begin();
164
21.3k
                std::copy(iter, iter + size, (uint8_t*)pic.y);
165
21.3k
                iter += size;
166
                // A.
167
21.3k
                if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) {
168
12.5k
                  std::copy(iter, iter + size, (uint8_t*)pic.a);
169
12.5k
                  iter += size;
170
12.5k
                }
171
                // U and V.
172
21.3k
                const int uv_width = (int)(((int64_t)width + 1) >> 1);
173
21.3k
                const int uv_height = (int)(((int64_t)height + 1) >> 1);
174
21.3k
                size = uv_width * uv_height;
175
21.3k
                std::copy(iter, iter + size, (uint8_t*)pic.u);
176
21.3k
                iter += size;
177
21.3k
                std::copy(iter, iter + size, (uint8_t*)pic.v);
178
21.3k
              }
179
23.6k
              return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width,
180
23.6k
                                    pic.height, pic.y, pic.u, pic.v,
181
23.6k
                                    pic.y_stride, pic.uv_stride, pic.a,
182
23.6k
                                    pic.a_stride, pic.argb, pic.argb_stride,
183
23.6k
                                    pic.memory_, pic.memory_argb_);
184
23.6k
            },
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.0k
             height](const std::vector<uint8_t>& data) -> WebPPictureCpp {
149
14.0k
              WebPPicture pic;
150
14.0k
              if (!WebPPictureInit(&pic)) assert(false);
151
14.0k
              pic.use_argb = colorspace == 0 ? 1 : 0;
152
14.0k
              pic.colorspace = static_cast<WebPEncCSP>(
153
14.0k
                  colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A);
154
14.0k
              pic.width = width;
155
14.0k
              pic.height = height;
156
14.0k
              if (!WebPPictureAlloc(&pic)) assert(false);
157
14.0k
              size_t size = width * height;
158
14.0k
              if (pic.use_argb) {
159
1.89k
                std::copy(data.begin(), data.begin() + size,
160
1.89k
                          (uint32_t*)pic.argb);
161
12.1k
              } else {
162
                // Y.
163
12.1k
                auto iter = data.begin();
164
12.1k
                std::copy(iter, iter + size, (uint8_t*)pic.y);
165
12.1k
                iter += size;
166
                // A.
167
12.1k
                if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) {
168
4.31k
                  std::copy(iter, iter + size, (uint8_t*)pic.a);
169
4.31k
                  iter += size;
170
4.31k
                }
171
                // U and V.
172
12.1k
                const int uv_width = (int)(((int64_t)width + 1) >> 1);
173
12.1k
                const int uv_height = (int)(((int64_t)height + 1) >> 1);
174
12.1k
                size = uv_width * uv_height;
175
12.1k
                std::copy(iter, iter + size, (uint8_t*)pic.u);
176
12.1k
                iter += size;
177
12.1k
                std::copy(iter, iter + size, (uint8_t*)pic.v);
178
12.1k
              }
179
14.0k
              return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width,
180
14.0k
                                    pic.height, pic.y, pic.u, pic.v,
181
14.0k
                                    pic.y_stride, pic.uv_stride, pic.a,
182
14.0k
                                    pic.a_stride, pic.argb, pic.argb_stride,
183
14.0k
                                    pic.memory_, pic.memory_argb_);
184
14.0k
            },
185
235k
            DataDomain);
186
235k
      },
enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) const
Line
Count
Source
134
122k
      [](int colorspace, int width, int height) {
135
122k
        const int uv_width = (int)(((int64_t)width + 1) >> 1);
136
122k
        const int uv_height = (int)(((int64_t)height + 1) >> 1);
137
        // Create a domain for the vector that strictly obeys w * h * 4.
138
122k
        size_t size = width * height;
139
122k
        if (colorspace == 0) size *= 4;
140
122k
        if (colorspace == 1) size += 2 * uv_width * uv_height;
141
122k
        if (colorspace == 2) size += 2 * uv_width * uv_height + size;
142
122k
        auto DataDomain =
143
122k
            fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size);
144
145
        // Map the vector domain back into our Image struct, injecting w and h
146
122k
        return fuzztest::Map(
147
122k
            [colorspace, width,
148
122k
             height](const std::vector<uint8_t>& data) -> WebPPictureCpp {
149
122k
              WebPPicture pic;
150
122k
              if (!WebPPictureInit(&pic)) assert(false);
151
122k
              pic.use_argb = colorspace == 0 ? 1 : 0;
152
122k
              pic.colorspace = static_cast<WebPEncCSP>(
153
122k
                  colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A);
154
122k
              pic.width = width;
155
122k
              pic.height = height;
156
122k
              if (!WebPPictureAlloc(&pic)) assert(false);
157
122k
              size_t size = width * height;
158
122k
              if (pic.use_argb) {
159
122k
                std::copy(data.begin(), data.begin() + size,
160
122k
                          (uint32_t*)pic.argb);
161
122k
              } else {
162
                // Y.
163
122k
                auto iter = data.begin();
164
122k
                std::copy(iter, iter + size, (uint8_t*)pic.y);
165
122k
                iter += size;
166
                // A.
167
122k
                if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) {
168
122k
                  std::copy(iter, iter + size, (uint8_t*)pic.a);
169
122k
                  iter += size;
170
122k
                }
171
                // U and V.
172
122k
                const int uv_width = (int)(((int64_t)width + 1) >> 1);
173
122k
                const int uv_height = (int)(((int64_t)height + 1) >> 1);
174
122k
                size = uv_width * uv_height;
175
122k
                std::copy(iter, iter + size, (uint8_t*)pic.u);
176
122k
                iter += size;
177
122k
                std::copy(iter, iter + size, (uint8_t*)pic.v);
178
122k
              }
179
122k
              return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width,
180
122k
                                    pic.height, pic.y, pic.u, pic.v,
181
122k
                                    pic.y_stride, pic.uv_stride, pic.a,
182
122k
                                    pic.a_stride, pic.argb, pic.argb_stride,
183
122k
                                    pic.memory_, pic.memory_argb_);
184
122k
            },
185
122k
            DataDomain);
186
122k
      },
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) const
Line
Count
Source
134
71.1k
      [](int colorspace, int width, int height) {
135
71.1k
        const int uv_width = (int)(((int64_t)width + 1) >> 1);
136
71.1k
        const int uv_height = (int)(((int64_t)height + 1) >> 1);
137
        // Create a domain for the vector that strictly obeys w * h * 4.
138
71.1k
        size_t size = width * height;
139
71.1k
        if (colorspace == 0) size *= 4;
140
71.1k
        if (colorspace == 1) size += 2 * uv_width * uv_height;
141
71.1k
        if (colorspace == 2) size += 2 * uv_width * uv_height + size;
142
71.1k
        auto DataDomain =
143
71.1k
            fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size);
144
145
        // Map the vector domain back into our Image struct, injecting w and h
146
71.1k
        return fuzztest::Map(
147
71.1k
            [colorspace, width,
148
71.1k
             height](const std::vector<uint8_t>& data) -> WebPPictureCpp {
149
71.1k
              WebPPicture pic;
150
71.1k
              if (!WebPPictureInit(&pic)) assert(false);
151
71.1k
              pic.use_argb = colorspace == 0 ? 1 : 0;
152
71.1k
              pic.colorspace = static_cast<WebPEncCSP>(
153
71.1k
                  colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A);
154
71.1k
              pic.width = width;
155
71.1k
              pic.height = height;
156
71.1k
              if (!WebPPictureAlloc(&pic)) assert(false);
157
71.1k
              size_t size = width * height;
158
71.1k
              if (pic.use_argb) {
159
71.1k
                std::copy(data.begin(), data.begin() + size,
160
71.1k
                          (uint32_t*)pic.argb);
161
71.1k
              } else {
162
                // Y.
163
71.1k
                auto iter = data.begin();
164
71.1k
                std::copy(iter, iter + size, (uint8_t*)pic.y);
165
71.1k
                iter += size;
166
                // A.
167
71.1k
                if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) {
168
71.1k
                  std::copy(iter, iter + size, (uint8_t*)pic.a);
169
71.1k
                  iter += size;
170
71.1k
                }
171
                // U and V.
172
71.1k
                const int uv_width = (int)(((int64_t)width + 1) >> 1);
173
71.1k
                const int uv_height = (int)(((int64_t)height + 1) >> 1);
174
71.1k
                size = uv_width * uv_height;
175
71.1k
                std::copy(iter, iter + size, (uint8_t*)pic.u);
176
71.1k
                iter += size;
177
71.1k
                std::copy(iter, iter + size, (uint8_t*)pic.v);
178
71.1k
              }
179
71.1k
              return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width,
180
71.1k
                                    pic.height, pic.y, pic.u, pic.v,
181
71.1k
                                    pic.y_stride, pic.uv_stride, pic.a,
182
71.1k
                                    pic.a_stride, pic.argb, pic.argb_stride,
183
71.1k
                                    pic.memory_, pic.memory_argb_);
184
71.1k
            },
185
71.1k
            DataDomain);
186
71.1k
      },
enc_fuzzer.cc:fuzz_utils::ArbitraryWebPPicture()::{lambda(int, int, int)#1}::operator()(int, int, int) const
Line
Count
Source
134
42.3k
      [](int colorspace, int width, int height) {
135
42.3k
        const int uv_width = (int)(((int64_t)width + 1) >> 1);
136
42.3k
        const int uv_height = (int)(((int64_t)height + 1) >> 1);
137
        // Create a domain for the vector that strictly obeys w * h * 4.
138
42.3k
        size_t size = width * height;
139
42.3k
        if (colorspace == 0) size *= 4;
140
42.3k
        if (colorspace == 1) size += 2 * uv_width * uv_height;
141
42.3k
        if (colorspace == 2) size += 2 * uv_width * uv_height + size;
142
42.3k
        auto DataDomain =
143
42.3k
            fuzztest::VectorOf(fuzztest::Arbitrary<uint8_t>()).WithSize(size);
144
145
        // Map the vector domain back into our Image struct, injecting w and h
146
42.3k
        return fuzztest::Map(
147
42.3k
            [colorspace, width,
148
42.3k
             height](const std::vector<uint8_t>& data) -> WebPPictureCpp {
149
42.3k
              WebPPicture pic;
150
42.3k
              if (!WebPPictureInit(&pic)) assert(false);
151
42.3k
              pic.use_argb = colorspace == 0 ? 1 : 0;
152
42.3k
              pic.colorspace = static_cast<WebPEncCSP>(
153
42.3k
                  colorspace <= 1 ? WEBP_YUV420 : WEBP_YUV420A);
154
42.3k
              pic.width = width;
155
42.3k
              pic.height = height;
156
42.3k
              if (!WebPPictureAlloc(&pic)) assert(false);
157
42.3k
              size_t size = width * height;
158
42.3k
              if (pic.use_argb) {
159
42.3k
                std::copy(data.begin(), data.begin() + size,
160
42.3k
                          (uint32_t*)pic.argb);
161
42.3k
              } else {
162
                // Y.
163
42.3k
                auto iter = data.begin();
164
42.3k
                std::copy(iter, iter + size, (uint8_t*)pic.y);
165
42.3k
                iter += size;
166
                // A.
167
42.3k
                if ((int)pic.colorspace & WEBP_CSP_ALPHA_BIT) {
168
42.3k
                  std::copy(iter, iter + size, (uint8_t*)pic.a);
169
42.3k
                  iter += size;
170
42.3k
                }
171
                // U and V.
172
42.3k
                const int uv_width = (int)(((int64_t)width + 1) >> 1);
173
42.3k
                const int uv_height = (int)(((int64_t)height + 1) >> 1);
174
42.3k
                size = uv_width * uv_height;
175
42.3k
                std::copy(iter, iter + size, (uint8_t*)pic.u);
176
42.3k
                iter += size;
177
42.3k
                std::copy(iter, iter + size, (uint8_t*)pic.v);
178
42.3k
              }
179
42.3k
              return WebPPictureCpp(pic.use_argb, pic.colorspace, pic.width,
180
42.3k
                                    pic.height, pic.y, pic.u, pic.v,
181
42.3k
                                    pic.y_stride, pic.uv_stride, pic.a,
182
42.3k
                                    pic.a_stride, pic.argb, pic.argb_stride,
183
42.3k
                                    pic.memory_, pic.memory_argb_);
184
42.3k
            },
185
42.3k
            DataDomain);
186
42.3k
      },
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
26.1k
      [](int index, bool use_argb) -> WebPPictureCpp {
195
        // Map the vector domain back into our Image struct, injecting w and h
196
26.1k
        WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb);
197
26.1k
        return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height,
198
26.1k
                              pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride,
199
26.1k
                              pic.a, pic.a_stride, pic.argb, pic.argb_stride,
200
26.1k
                              pic.memory_, pic.memory_argb_);
201
26.1k
      },
enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex()::{lambda(int, bool)#1}::operator()(int, bool) const
Line
Count
Source
194
13.1k
      [](int index, bool use_argb) -> WebPPictureCpp {
195
        // Map the vector domain back into our Image struct, injecting w and h
196
13.1k
        WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb);
197
13.1k
        return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height,
198
13.1k
                              pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride,
199
13.1k
                              pic.a, pic.a_stride, pic.argb, pic.argb_stride,
200
13.1k
                              pic.memory_, pic.memory_argb_);
201
13.1k
      },
animencoder_fuzzer.cc:fuzz_utils::ArbitraryWebPPictureFromIndex()::{lambda(int, bool)#1}::operator()(int, bool) const
Line
Count
Source
194
13.0k
      [](int index, bool use_argb) -> WebPPictureCpp {
195
        // Map the vector domain back into our Image struct, injecting w and h
196
13.0k
        WebPPicture pic = fuzz_utils::GetSourcePicture(index, use_argb);
197
13.0k
        return WebPPictureCpp(use_argb, pic.colorspace, pic.width, pic.height,
198
13.0k
                              pic.y, pic.u, pic.v, pic.y_stride, pic.uv_stride,
199
13.0k
                              pic.a, pic.a_stride, pic.argb, pic.argb_stride,
200
13.0k
                              pic.memory_, pic.memory_argb_);
201
13.0k
      },
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
104k
         int use_delta_palette, int use_sharp_yuv) -> WebPConfig {
215
104k
        WebPConfig config;
216
104k
        if (!WebPConfigInit(&config)) assert(false);
217
104k
        config.lossless = lossless;
218
104k
        config.quality = quality;
219
104k
        config.method = method;
220
104k
        config.image_hint = (WebPImageHint)image_hint;
221
104k
        config.segments = segments;
222
104k
        config.sns_strength = sns_strength;
223
104k
        config.filter_strength = filter_strength;
224
104k
        config.filter_sharpness = filter_sharpness;
225
104k
        config.filter_type = filter_type;
226
104k
        config.autofilter = autofilter;
227
104k
        config.alpha_compression = alpha_compression;
228
104k
        config.alpha_filtering = alpha_filtering;
229
104k
        config.alpha_quality = alpha_quality;
230
104k
        config.pass = pass;
231
104k
        config.show_compressed = 1;
232
104k
        config.preprocessing = preprocessing;
233
104k
        config.partitions = partitions;
234
104k
        config.partition_limit = 10 * partition_limit;
235
104k
        config.emulate_jpeg_size = emulate_jpeg_size;
236
104k
        config.thread_level = thread_level;
237
104k
        config.low_memory = low_memory;
238
104k
        config.near_lossless = 20 * near_lossless;
239
104k
        config.exact = exact;
240
104k
        config.use_delta_palette = use_delta_palette;
241
104k
        config.use_sharp_yuv = use_sharp_yuv;
242
104k
        if (!WebPValidateConfig(&config)) assert(false);
243
104k
        return config;
244
104k
      },
enc_dec_fuzzer.cc:fuzz_utils::ArbitraryWebPConfig()::{lambda(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)#1}::operator()(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) const
Line
Count
Source
214
53.7k
         int use_delta_palette, int use_sharp_yuv) -> WebPConfig {
215
53.7k
        WebPConfig config;
216
53.7k
        if (!WebPConfigInit(&config)) assert(false);
217
53.7k
        config.lossless = lossless;
218
53.7k
        config.quality = quality;
219
53.7k
        config.method = method;
220
53.7k
        config.image_hint = (WebPImageHint)image_hint;
221
53.7k
        config.segments = segments;
222
53.7k
        config.sns_strength = sns_strength;
223
53.7k
        config.filter_strength = filter_strength;
224
53.7k
        config.filter_sharpness = filter_sharpness;
225
53.7k
        config.filter_type = filter_type;
226
53.7k
        config.autofilter = autofilter;
227
53.7k
        config.alpha_compression = alpha_compression;
228
53.7k
        config.alpha_filtering = alpha_filtering;
229
53.7k
        config.alpha_quality = alpha_quality;
230
53.7k
        config.pass = pass;
231
53.7k
        config.show_compressed = 1;
232
53.7k
        config.preprocessing = preprocessing;
233
53.7k
        config.partitions = partitions;
234
53.7k
        config.partition_limit = 10 * partition_limit;
235
53.7k
        config.emulate_jpeg_size = emulate_jpeg_size;
236
53.7k
        config.thread_level = thread_level;
237
53.7k
        config.low_memory = low_memory;
238
53.7k
        config.near_lossless = 20 * near_lossless;
239
53.7k
        config.exact = exact;
240
53.7k
        config.use_delta_palette = use_delta_palette;
241
53.7k
        config.use_sharp_yuv = use_sharp_yuv;
242
53.7k
        if (!WebPValidateConfig(&config)) assert(false);
243
53.7k
        return config;
244
53.7k
      },
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
36.6k
         int use_delta_palette, int use_sharp_yuv) -> WebPConfig {
215
36.6k
        WebPConfig config;
216
36.6k
        if (!WebPConfigInit(&config)) assert(false);
217
36.6k
        config.lossless = lossless;
218
36.6k
        config.quality = quality;
219
36.6k
        config.method = method;
220
36.6k
        config.image_hint = (WebPImageHint)image_hint;
221
36.6k
        config.segments = segments;
222
36.6k
        config.sns_strength = sns_strength;
223
36.6k
        config.filter_strength = filter_strength;
224
36.6k
        config.filter_sharpness = filter_sharpness;
225
36.6k
        config.filter_type = filter_type;
226
36.6k
        config.autofilter = autofilter;
227
36.6k
        config.alpha_compression = alpha_compression;
228
36.6k
        config.alpha_filtering = alpha_filtering;
229
36.6k
        config.alpha_quality = alpha_quality;
230
36.6k
        config.pass = pass;
231
36.6k
        config.show_compressed = 1;
232
36.6k
        config.preprocessing = preprocessing;
233
36.6k
        config.partitions = partitions;
234
36.6k
        config.partition_limit = 10 * partition_limit;
235
36.6k
        config.emulate_jpeg_size = emulate_jpeg_size;
236
36.6k
        config.thread_level = thread_level;
237
36.6k
        config.low_memory = low_memory;
238
36.6k
        config.near_lossless = 20 * near_lossless;
239
36.6k
        config.exact = exact;
240
36.6k
        config.use_delta_palette = use_delta_palette;
241
36.6k
        config.use_sharp_yuv = use_sharp_yuv;
242
36.6k
        if (!WebPValidateConfig(&config)) assert(false);
243
36.6k
        return config;
244
36.6k
      },
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.0k
         int use_delta_palette, int use_sharp_yuv) -> WebPConfig {
215
14.0k
        WebPConfig config;
216
14.0k
        if (!WebPConfigInit(&config)) assert(false);
217
14.0k
        config.lossless = lossless;
218
14.0k
        config.quality = quality;
219
14.0k
        config.method = method;
220
14.0k
        config.image_hint = (WebPImageHint)image_hint;
221
14.0k
        config.segments = segments;
222
14.0k
        config.sns_strength = sns_strength;
223
14.0k
        config.filter_strength = filter_strength;
224
14.0k
        config.filter_sharpness = filter_sharpness;
225
14.0k
        config.filter_type = filter_type;
226
14.0k
        config.autofilter = autofilter;
227
14.0k
        config.alpha_compression = alpha_compression;
228
14.0k
        config.alpha_filtering = alpha_filtering;
229
14.0k
        config.alpha_quality = alpha_quality;
230
14.0k
        config.pass = pass;
231
14.0k
        config.show_compressed = 1;
232
14.0k
        config.preprocessing = preprocessing;
233
14.0k
        config.partitions = partitions;
234
14.0k
        config.partition_limit = 10 * partition_limit;
235
14.0k
        config.emulate_jpeg_size = emulate_jpeg_size;
236
14.0k
        config.thread_level = thread_level;
237
14.0k
        config.low_memory = low_memory;
238
14.0k
        config.near_lossless = 20 * near_lossless;
239
14.0k
        config.exact = exact;
240
14.0k
        config.use_delta_palette = use_delta_palette;
241
14.0k
        config.use_sharp_yuv = use_sharp_yuv;
242
14.0k
        if (!WebPValidateConfig(&config)) assert(false);
243
14.0k
        return config;
244
14.0k
      },
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
21
static inline auto ArbitraryValidWebPDecoderOptions() {
292
21
  return fuzztest::Map(
293
21
      [](int bypass_filtering, int no_fancy_upsampling, int use_cropping,
294
21
         int crop_left, int crop_top, int crop_width, int crop_height,
295
21
         int use_scaling, int scaled_width, int scaled_height, int use_threads,
296
21
         int dithering_strength, int flip,
297
36.3k
         int alpha_dithering_strength) -> WebPDecoderOptionsCpp {
298
36.3k
        WebPDecoderOptions options;
299
36.3k
        options.bypass_filtering = bypass_filtering;
300
36.3k
        options.no_fancy_upsampling = no_fancy_upsampling;
301
36.3k
        options.use_cropping = use_cropping;
302
36.3k
        options.crop_left = crop_left;
303
36.3k
        options.crop_top = crop_top;
304
36.3k
        options.crop_width = crop_width;
305
36.3k
        options.crop_height = crop_height;
306
36.3k
        options.use_scaling = use_scaling;
307
36.3k
        options.scaled_width = scaled_width;
308
36.3k
        options.scaled_height = scaled_height;
309
36.3k
        options.use_threads = use_threads;
310
36.3k
        options.dithering_strength = dithering_strength;
311
36.3k
        options.flip = flip;
312
36.3k
        options.alpha_dithering_strength = alpha_dithering_strength;
313
36.3k
        WebPDecoderConfig config;
314
36.3k
        if (!WebPInitDecoderConfig(&config)) assert(false);
315
36.3k
        config.options = options;
316
36.3k
        if (!WebPValidateDecoderConfig(&config)) assert(false);
317
36.3k
        WebPDecoderOptionsCpp options_cpp;
318
36.3k
        std::memcpy(&options_cpp, &options, sizeof(options));
319
36.3k
        return options_cpp;
320
36.3k
      },
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
26.1k
         int alpha_dithering_strength) -> WebPDecoderOptionsCpp {
298
26.1k
        WebPDecoderOptions options;
299
26.1k
        options.bypass_filtering = bypass_filtering;
300
26.1k
        options.no_fancy_upsampling = no_fancy_upsampling;
301
26.1k
        options.use_cropping = use_cropping;
302
26.1k
        options.crop_left = crop_left;
303
26.1k
        options.crop_top = crop_top;
304
26.1k
        options.crop_width = crop_width;
305
26.1k
        options.crop_height = crop_height;
306
26.1k
        options.use_scaling = use_scaling;
307
26.1k
        options.scaled_width = scaled_width;
308
26.1k
        options.scaled_height = scaled_height;
309
26.1k
        options.use_threads = use_threads;
310
26.1k
        options.dithering_strength = dithering_strength;
311
26.1k
        options.flip = flip;
312
26.1k
        options.alpha_dithering_strength = alpha_dithering_strength;
313
26.1k
        WebPDecoderConfig config;
314
26.1k
        if (!WebPInitDecoderConfig(&config)) assert(false);
315
26.1k
        config.options = options;
316
26.1k
        if (!WebPValidateDecoderConfig(&config)) assert(false);
317
26.1k
        WebPDecoderOptionsCpp options_cpp;
318
26.1k
        std::memcpy(&options_cpp, &options, sizeof(options));
319
26.1k
        return options_cpp;
320
26.1k
      },
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
2.12k
         int alpha_dithering_strength) -> WebPDecoderOptionsCpp {
298
2.12k
        WebPDecoderOptions options;
299
2.12k
        options.bypass_filtering = bypass_filtering;
300
2.12k
        options.no_fancy_upsampling = no_fancy_upsampling;
301
2.12k
        options.use_cropping = use_cropping;
302
2.12k
        options.crop_left = crop_left;
303
2.12k
        options.crop_top = crop_top;
304
2.12k
        options.crop_width = crop_width;
305
2.12k
        options.crop_height = crop_height;
306
2.12k
        options.use_scaling = use_scaling;
307
2.12k
        options.scaled_width = scaled_width;
308
2.12k
        options.scaled_height = scaled_height;
309
2.12k
        options.use_threads = use_threads;
310
2.12k
        options.dithering_strength = dithering_strength;
311
2.12k
        options.flip = flip;
312
2.12k
        options.alpha_dithering_strength = alpha_dithering_strength;
313
2.12k
        WebPDecoderConfig config;
314
2.12k
        if (!WebPInitDecoderConfig(&config)) assert(false);
315
2.12k
        config.options = options;
316
2.12k
        if (!WebPValidateDecoderConfig(&config)) assert(false);
317
2.12k
        WebPDecoderOptionsCpp options_cpp;
318
2.12k
        std::memcpy(&options_cpp, &options, sizeof(options));
319
2.12k
        return options_cpp;
320
2.12k
      },
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.03k
         int alpha_dithering_strength) -> WebPDecoderOptionsCpp {
298
8.03k
        WebPDecoderOptions options;
299
8.03k
        options.bypass_filtering = bypass_filtering;
300
8.03k
        options.no_fancy_upsampling = no_fancy_upsampling;
301
8.03k
        options.use_cropping = use_cropping;
302
8.03k
        options.crop_left = crop_left;
303
8.03k
        options.crop_top = crop_top;
304
8.03k
        options.crop_width = crop_width;
305
8.03k
        options.crop_height = crop_height;
306
8.03k
        options.use_scaling = use_scaling;
307
8.03k
        options.scaled_width = scaled_width;
308
8.03k
        options.scaled_height = scaled_height;
309
8.03k
        options.use_threads = use_threads;
310
8.03k
        options.dithering_strength = dithering_strength;
311
8.03k
        options.flip = flip;
312
8.03k
        options.alpha_dithering_strength = alpha_dithering_strength;
313
8.03k
        WebPDecoderConfig config;
314
8.03k
        if (!WebPInitDecoderConfig(&config)) assert(false);
315
8.03k
        config.options = options;
316
8.03k
        if (!WebPValidateDecoderConfig(&config)) assert(false);
317
8.03k
        WebPDecoderOptionsCpp options_cpp;
318
8.03k
        std::memcpy(&options_cpp, &options, sizeof(options));
319
8.03k
        return options_cpp;
320
8.03k
      },
321
21
      /*bypass_filtering=*/fuzztest::InRange<int>(0, 1),
322
21
      /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1),
323
21
      /*use_cropping=*/fuzztest::InRange<int>(0, 1),
324
21
      /*crop_left=*/fuzztest::InRange<int>(0, 10),
325
21
      /*crop_top=*/fuzztest::InRange<int>(0, 10),
326
21
      /*crop_width=*/fuzztest::InRange<int>(1, 10),
327
21
      /*crop_height=*/fuzztest::InRange<int>(1, 10),
328
21
      /*use_scaling=*/fuzztest::InRange<int>(0, 1),
329
21
      /*scaled_width=*/fuzztest::InRange<int>(1, 10),
330
21
      /*scaled_height=*/fuzztest::InRange<int>(1, 10),
331
21
      /*use_threads=*/fuzztest::InRange<int>(0, 1),
332
21
      /*dithering_strength=*/fuzztest::InRange<int>(0, 100),
333
21
      /*flip=*/fuzztest::InRange<int>(0, 1),
334
21
      /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100));
335
21
}
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
3
static inline auto ArbitraryValidWebPDecoderOptions() {
292
3
  return fuzztest::Map(
293
3
      [](int bypass_filtering, int no_fancy_upsampling, int use_cropping,
294
3
         int crop_left, int crop_top, int crop_width, int crop_height,
295
3
         int use_scaling, int scaled_width, int scaled_height, int use_threads,
296
3
         int dithering_strength, int flip,
297
3
         int alpha_dithering_strength) -> WebPDecoderOptionsCpp {
298
3
        WebPDecoderOptions options;
299
3
        options.bypass_filtering = bypass_filtering;
300
3
        options.no_fancy_upsampling = no_fancy_upsampling;
301
3
        options.use_cropping = use_cropping;
302
3
        options.crop_left = crop_left;
303
3
        options.crop_top = crop_top;
304
3
        options.crop_width = crop_width;
305
3
        options.crop_height = crop_height;
306
3
        options.use_scaling = use_scaling;
307
3
        options.scaled_width = scaled_width;
308
3
        options.scaled_height = scaled_height;
309
3
        options.use_threads = use_threads;
310
3
        options.dithering_strength = dithering_strength;
311
3
        options.flip = flip;
312
3
        options.alpha_dithering_strength = alpha_dithering_strength;
313
3
        WebPDecoderConfig config;
314
3
        if (!WebPInitDecoderConfig(&config)) assert(false);
315
3
        config.options = options;
316
3
        if (!WebPValidateDecoderConfig(&config)) assert(false);
317
3
        WebPDecoderOptionsCpp options_cpp;
318
3
        std::memcpy(&options_cpp, &options, sizeof(options));
319
3
        return options_cpp;
320
3
      },
321
3
      /*bypass_filtering=*/fuzztest::InRange<int>(0, 1),
322
3
      /*no_fancy_upsampling=*/fuzztest::InRange<int>(0, 1),
323
3
      /*use_cropping=*/fuzztest::InRange<int>(0, 1),
324
3
      /*crop_left=*/fuzztest::InRange<int>(0, 10),
325
3
      /*crop_top=*/fuzztest::InRange<int>(0, 10),
326
3
      /*crop_width=*/fuzztest::InRange<int>(1, 10),
327
3
      /*crop_height=*/fuzztest::InRange<int>(1, 10),
328
3
      /*use_scaling=*/fuzztest::InRange<int>(0, 1),
329
3
      /*scaled_width=*/fuzztest::InRange<int>(1, 10),
330
3
      /*scaled_height=*/fuzztest::InRange<int>(1, 10),
331
3
      /*use_threads=*/fuzztest::InRange<int>(0, 1),
332
3
      /*dithering_strength=*/fuzztest::InRange<int>(0, 100),
333
3
      /*flip=*/fuzztest::InRange<int>(0, 1),
334
3
      /*alpha_dithering_strength=*/fuzztest::InRange<int>(0, 100));
335
3
}
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
27.5k
         int alpha_dithering_strength) -> WebPDecoderOptionsCpp {
344
27.5k
        WebPDecoderOptions options;
345
27.5k
        options.bypass_filtering = bypass_filtering;
346
27.5k
        options.no_fancy_upsampling = no_fancy_upsampling;
347
27.5k
        options.use_cropping = use_cropping;
348
27.5k
        options.crop_left = crop_left;
349
27.5k
        options.crop_top = crop_top;
350
27.5k
        options.crop_width = crop_width;
351
27.5k
        options.crop_height = crop_height;
352
27.5k
        options.use_scaling = use_scaling;
353
27.5k
        options.scaled_width = scaled_width;
354
27.5k
        options.scaled_height = scaled_height;
355
27.5k
        options.use_threads = use_threads;
356
27.5k
        options.dithering_strength = dithering_strength;
357
27.5k
        options.flip = flip;
358
27.5k
        options.alpha_dithering_strength = alpha_dithering_strength;
359
27.5k
        WebPDecoderOptionsCpp options_cpp;
360
27.5k
        std::memcpy(&options_cpp, &options, sizeof(options));
361
27.5k
        return options_cpp;
362
27.5k
      },
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
104k
          -> CropOrScaleParams {
393
104k
        CropOrScaleParams params;
394
104k
        params.alter_input = width_height_ratio.has_value();
395
104k
        if (params.alter_input) {
396
40.9k
          params.width_ratio = width_height_ratio->first;
397
40.9k
          params.height_ratio = width_height_ratio->second;
398
40.9k
          params.crop_or_scale = left_top_ratio.has_value();
399
40.9k
          if (params.crop_or_scale) {
400
8.71k
            params.left_ratio = left_top_ratio->first;
401
8.71k
            params.top_ratio = left_top_ratio->second;
402
8.71k
          }
403
40.9k
        }
404
104k
        return params;
405
104k
      },
enc_dec_fuzzer.cc:fuzz_utils::ArbitraryCropOrScaleParams()::{lambda(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&)#1}::operator()(std::__1::optional<std::__1::pair<int, int> > const&, std::__1::optional<std::__1::pair<int, int> > const&) const
Line
Count
Source
392
53.7k
          -> CropOrScaleParams {
393
53.7k
        CropOrScaleParams params;
394
53.7k
        params.alter_input = width_height_ratio.has_value();
395
53.7k
        if (params.alter_input) {
396
21.2k
          params.width_ratio = width_height_ratio->first;
397
21.2k
          params.height_ratio = width_height_ratio->second;
398
21.2k
          params.crop_or_scale = left_top_ratio.has_value();
399
21.2k
          if (params.crop_or_scale) {
400
3.76k
            params.left_ratio = left_top_ratio->first;
401
3.76k
            params.top_ratio = left_top_ratio->second;
402
3.76k
          }
403
21.2k
        }
404
53.7k
        return params;
405
53.7k
      },
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
36.6k
          -> CropOrScaleParams {
393
36.6k
        CropOrScaleParams params;
394
36.6k
        params.alter_input = width_height_ratio.has_value();
395
36.6k
        if (params.alter_input) {
396
13.5k
          params.width_ratio = width_height_ratio->first;
397
13.5k
          params.height_ratio = width_height_ratio->second;
398
13.5k
          params.crop_or_scale = left_top_ratio.has_value();
399
13.5k
          if (params.crop_or_scale) {
400
4.47k
            params.left_ratio = left_top_ratio->first;
401
4.47k
            params.top_ratio = left_top_ratio->second;
402
4.47k
          }
403
13.5k
        }
404
36.6k
        return params;
405
36.6k
      },
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.0k
          -> CropOrScaleParams {
393
14.0k
        CropOrScaleParams params;
394
14.0k
        params.alter_input = width_height_ratio.has_value();
395
14.0k
        if (params.alter_input) {
396
6.14k
          params.width_ratio = width_height_ratio->first;
397
6.14k
          params.height_ratio = width_height_ratio->second;
398
6.14k
          params.crop_or_scale = left_top_ratio.has_value();
399
6.14k
          if (params.crop_or_scale) {
400
480
            params.left_ratio = left_top_ratio->first;
401
480
            params.top_ratio = left_top_ratio->second;
402
480
          }
403
6.14k
        }
404
14.0k
        return params;
405
14.0k
      },
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_