libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

set_from_bytes_fuzzer.cc (945B)


      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 <stddef.h>
      7 #include <stdint.h>
      8 
      9 #include "lib/extras/codec.h"
     10 #include "lib/extras/size_constraints.h"
     11 #include "lib/jxl/base/data_parallel.h"
     12 #include "lib/jxl/base/span.h"
     13 #include "lib/jxl/codec_in_out.h"
     14 #include "tools/thread_pool_internal.h"
     15 
     16 namespace {
     17 
     18 int TestOneInput(const uint8_t* data, size_t size) {
     19   jxl::CodecInOut io;
     20   jxl::SizeConstraints constraints;
     21   constraints.dec_max_xsize = 1u << 16;
     22   constraints.dec_max_ysize = 1u << 16;
     23   constraints.dec_max_pixels = 1u << 22;
     24   jpegxl::tools::ThreadPoolInternal pool(0);
     25 
     26   (void)jxl::SetFromBytes(jxl::Bytes(data, size), &io, &pool, &constraints);
     27 
     28   return 0;
     29 }
     30 
     31 }  // namespace
     32 
     33 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
     34   return TestOneInput(data, size);
     35 }