Coverage Report

Created: 2025-11-09 06:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwebp/tests/fuzzer/webp_info_fuzzer.cc
Line
Count
Source
1
// Copyright 2024 Google Inc.
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
#include <cstdint>
18
#include <string_view>
19
20
#include "./nalloc.h"
21
#include "src/webp/mux_types.h"
22
#include "tests/fuzzer/fuzz_utils.h"
23
24
// Don't do that at home!
25
#define main exec_main
26
#include "examples/webpinfo.c"
27
#undef main
28
29
1.28k
void WebPInfoTest(std::string_view data) {
30
1.28k
  nalloc_init(nullptr);
31
1.28k
  nalloc_start(reinterpret_cast<const uint8_t*>(data.data()), data.size());
32
1.28k
  WebPInfo webp_info;
33
1.28k
  WebPInfoInit(&webp_info);
34
1.28k
  webp_info.quiet = 1;
35
1.28k
  webp_info.show_summary = 0;
36
1.28k
  webp_info.show_diagnosis = 0;
37
1.28k
  webp_info.parse_bitstream = 1;
38
1.28k
  WebPData webp_data = {reinterpret_cast<const uint8_t*>(data.data()),
39
1.28k
                        data.size()};
40
1.28k
  AnalyzeWebP(&webp_info, &webp_data);
41
1.28k
  nalloc_end();
42
1.28k
}
43
44
FUZZ_TEST(WebPInfo, WebPInfoTest)
45
    .WithDomains(fuzztest::String().WithMaxSize(fuzz_utils::kMaxWebPFileSize +
46
                                                1));