Skip to content

tests/fuzzer: add picture_gaps_fuzzer#17

Closed
jortles wants to merge 1 commit into
webmproject:mainfrom
jortles:add-picture-gaps-fuzzer
Closed

tests/fuzzer: add picture_gaps_fuzzer#17
jortles wants to merge 1 commit into
webmproject:mainfrom
jortles:add-picture-gaps-fuzzer

Conversation

@jortles
Copy link
Copy Markdown

@jortles jortles commented May 8, 2026

tests/fuzzer: add picture_gaps_fuzzer

Adds tests/fuzzer/picture_gaps_fuzzer.cc, a FuzzTest-style harness that targets six API surfaces not exercised by the existing fuzzers in this directory.

Surfaces covered (with rationale)

Surface Existing coverage Why this is a gap
WebPPictureView None enc_fuzzer.cc and enc_dec_fuzzer.cc only call WebPPictureInit/Free
WebPPictureCrop None same
WebPPictureRescale None same
WebPPictureImport{RGB,RGBA,RGBX,BGR,BGRA,BGRX} w/ caller stride None encode-side input ingestion not fuzzed
WebPDecode w/ output.is_external_memory = 1 None advanced_api_fuzzer always uses internal memory
SharpYuvConvert (libsharpyuv standalone) None exercised only indirectly via encode paths that pre-clamp inputs

The dispatch is six independent FUZZ_TEST entries, each accepting a std::string_view and parsing parameters internally — same pattern as huffman_fuzzer's FUZZ_TEST(Huffman, HuffmanTest).WithDomains(fuzztest::String()).

Files changed

  • tests/fuzzer/picture_gaps_fuzzer.cc — new file, ~250 lines, Apache 2.0 header (matches sibling fuzzers)
  • tests/fuzzer/CMakeLists.txt — one add_webp_fuzztest line wiring the new target with the sharpyuv extra-link dependency

Coverage

Locally with AFL++ (instrumented build, ASAN), picture_gaps_fuzzer reaches edges in WebPPicture*, SharpYuvConvert, and the is_external_memory=1 decode path that the other fuzzers never hit. The fuzzer reaches steady-state coverage (≈4,700 instrumented edges) within the first hour from a 60-seed minimized corpus.

Notes

  • No new third-party deps; uses only webp/{decode,encode}.h, sharpyuv/sharpyuv*.h, and fuzztest/fuzztest.h already used by sibling fuzzers.
  • All FUZZ_TESTs parse parameters defensively and bound outputs with kMaxOutputBytes / kMaxDim to keep timeouts at parity with the existing fuzzers.
  • The SharpYuvTest mode exercises 8/10-bit RGB and 8/10-bit YUV combinations, including the higher-bit-depth path where the input pixel range can exceed 1 << bit_depth.

Adds a FuzzTest harness covering API surfaces not exercised by the
existing fuzzers in this directory:

- WebPPictureView (sub-rectangle view + encode of the view)
- WebPPictureCrop (in-place crop with caller dimensions)
- WebPPictureRescale (arbitrary target dimensions)
- WebPPictureImport{RGB,RGBA,RGBX,BGR,BGRA,BGRX} with caller-supplied
  stride (over-aligned + tight strides)
- WebPDecode with output.is_external_memory = 1 (caller-supplied
  output buffer + stride)
- SharpYuvConvert (libsharpyuv standalone, all bit-depth and matrix
  combinations)

The existing enc_fuzzer / enc_dec_fuzzer only call WebPPictureInit /
Free; the WebPPicture* manipulation chain and the libsharpyuv standalone
API are otherwise untested. advanced_api_fuzzer always uses internal
output memory; the is_external_memory=1 decode path is also new
coverage.

Each surface is a separate FUZZ_TEST entry that takes a string_view
and parses parameters internally, mirroring huffman_fuzzer's pattern.
@jortles jortles closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant