pdftract/fuzz/fuzz_targets/content.rs
jedarden 3e10daa2a1 fix(bf-2zdma): restore content fuzz harness and verify build
- Restore fuzz/fuzz_targets/content.rs from commit b05a90c6
- File was missing from current tree but defined in Cargo.toml
- Verify cargo fuzz build content completes successfully
- Add verification note at notes/bf-2zdma.md

Acceptance criteria:
- cargo fuzz build content completes successfully: PASS
- No compilation errors or warnings: PASS
- fuzz/target directory exists and contains build artifacts: PASS
- All fuzz dependencies are resolved: PASS

Closes bf-2zdma
2026-07-05 17:27:10 -04:00

22 lines
822 B
Rust

//! Fuzz target for the PDF content stream interpreter.
//!
//! This target tests INV-8 (no panic at public boundary) for the content stream interpreter.
//! Any panic indicates a content stream bug that must be fixed.
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
use pdftract_core::content_stream::{process_with_mode, ProcessingMode};
use pdftract_core::parser::resources::ResourceDict;
// The content stream interpreter must never panic on any input
// Create a minimal empty resource dict for testing
let resources = ResourceDict::new();
// Test in Normal mode
let _ = process_with_mode(data, &resources, ProcessingMode::Normal, None);
// Test in PositionHint mode
let _ = process_with_mode(data, &resources, ProcessingMode::PositionHint, None);
});