Skip to content

fuzz: add fuzz_jp2_metadata for JP2 container header and box parsing#1639

Open
XananasX7 wants to merge 1 commit into
uclouvain:masterfrom
XananasX7:add-jp2-metadata-fuzzer
Open

fuzz: add fuzz_jp2_metadata for JP2 container header and box parsing#1639
XananasX7 wants to merge 1 commit into
uclouvain:masterfrom
XananasX7:add-jp2-metadata-fuzzer

Conversation

@XananasX7
Copy link
Copy Markdown

Summary

Adds a new libFuzzer harness targeting the JP2 container box/metadata parsing path in openjpeg.

New fuzzer: tests/fuzzers/fuzz_jp2_metadata.c

What it exercises:

  • opj_read_header() — parses JP2 box structure (JP2H, COLR, PCLR, CMAP, CDEF, RES, XML, UUID boxes)
  • Embedded metadata: XMP, ICC color profiles, palette/channel mapping
  • Header-only path (no codestream decode) — reachable even with truncated files

Why this matters:
The existing fuzzers in tests/fuzzers/ focus on full image decoding. The JP2 container parsing code in src/lib/openjp2/jp2.c processes variable-length boxes of arbitrary type and length, reading embedded strings, binary color profiles, and palette data. A malformed JP2 file with adversarial box lengths could trigger out-of-bounds reads before the codestream decoder is ever invoked.

Build: integrates with the existing build_google_oss_fuzzers.sh script.

Add a libFuzzer harness targeting opj_read_header() which parses JP2
container boxes (JP2H, COLR, PCLR, CMAP, CDEF, RES, XML, UUID, etc.)
and embedded metadata (XMP, ICC profiles) without decoding the full
codestream.

The existing fuzzers focus on full image decoding; this harness targets
the metadata/header parsing path which processes variable-length boxes
of arbitrary type and can be reached even with truncated or malformed
JP2 files that fail codestream decoding.
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