djxl_fuzzer_test.cc (1934B)
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 #include <jxl/thread_parallel_runner.h> 7 #include <jxl/thread_parallel_runner_cxx.h> 8 9 #include <cstdint> 10 #include <sstream> 11 #include <string> 12 #include <vector> 13 14 #include "lib/jxl/test_utils.h" 15 #include "lib/jxl/testing.h" 16 17 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); 18 19 std::vector<uint64_t> AllTestIds() { 20 return { 21 4546077333782528, 4716049045520384, 4718378999218176, 4729306868219904, 22 4787817341911040, 4816304719134720, 4848606801166336, 4859247059402752, 23 4887504894951424, 4984529666834432, 5014934495297536, 5112097090961408, 24 5189497920290816, 5381727462227968, 5382562858532864, 5392074930782208, 25 5467620336336896, 5473482434019328, 5489367788945408, 5556400888086528, 26 5582808628723712, 5631220790198272, 5685623166468096, 5737500246671360, 27 5785438255710208, 5800733037953024, 5849986531721216, 5858549672050688, 28 5899664422993920, 5900921718046720, 5906295376445440, 5914266367557632, 29 6013780411154432, 6165169006313472, 6277573962760192, 6329817929220096, 30 6355777170833408, 6375307931680768, 6448658097242112, 6515680276512768, 31 6569981946494976, 6735607318052864, 6737321070821376, 6748486320652288, 32 }; 33 } 34 35 class DjxlFuzzerTest : public ::testing::TestWithParam<uint64_t> {}; 36 JXL_GTEST_INSTANTIATE_TEST_SUITE_P(DjxlFuzzerTestInstantiation, DjxlFuzzerTest, 37 ::testing::ValuesIn(AllTestIds())); 38 TEST_P(DjxlFuzzerTest, TestOne) { 39 uint64_t id = GetParam(); 40 std::ostringstream os; 41 os << "oss-fuzz/clusterfuzz-testcase-minimized-djxl_fuzzer-" << id; 42 printf("Testing %s\n", os.str().c_str()); 43 const std::vector<uint8_t> input = jxl::test::ReadTestData(os.str()); 44 LLVMFuzzerTestOneInput(input.data(), input.size()); 45 }