webp_info_fuzzer.cc (1383B)
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 "src/webp/mux_types.h" 21 #include "tests/fuzzer/fuzz_utils.h" 22 23 // Don't do that at home! 24 #define main exec_main 25 #include "examples/webpinfo.c" 26 #undef main 27 28 void WebPInfoTest(std::string_view data) { 29 WebPInfo webp_info; 30 WebPInfoInit(&webp_info); 31 webp_info.quiet = 1; 32 webp_info.show_summary = 0; 33 webp_info.show_diagnosis = 0; 34 webp_info.parse_bitstream = 1; 35 WebPData webp_data = {reinterpret_cast<const uint8_t *>(data.data()), 36 data.size()}; 37 AnalyzeWebP(&webp_info, &webp_data); 38 } 39 40 FUZZ_TEST(WebPInfo, WebPInfoTest) 41 .WithDomains( 42 fuzztest::String() 43 .WithMaxSize(fuzz_utils::kMaxWebPFileSize + 1));