diff --git a/fuzz/fuzz_targets/content.rs b/fuzz/fuzz_targets/content.rs new file mode 100644 index 0000000..25792b3 --- /dev/null +++ b/fuzz/fuzz_targets/content.rs @@ -0,0 +1,22 @@ +//! 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); +}); diff --git a/notes/bf-2zdma.md b/notes/bf-2zdma.md new file mode 100644 index 0000000..8553ec6 --- /dev/null +++ b/notes/bf-2zdma.md @@ -0,0 +1,39 @@ +# Verification: bf-2zdma - Verify fuzz harness builds without errors + +## Date +2026-07-05 + +## Task +Verify that the content fuzz harness compiles successfully and all dependencies are properly configured. + +## Findings + +### Issue Discovered +The `content.rs` fuzz target was defined in `fuzz/Cargo.toml` but the source file `fuzz/fuzz_targets/content.rs` was missing from the current tree. The file existed in commit `b05a90c6` ("chore: add fuzz harness content parser") but was not present in the current working tree or HEAD. + +### Resolution +Restored `fuzz/fuzz_targets/content.rs` from commit `b05a90c6`. The file contains: +- Fuzz target for PDF content stream interpreter +- Tests INV-8 (no panic at public boundary) +- Tests both `ProcessingMode::Normal` and `ProcessingMode::PositionHint` + +### Build Verification +- Command: `cargo fuzz build content` +- Result: **SUCCESS** - no compilation errors or warnings +- Build artifact: `fuzz/target/x86_64-unknown-linux-gnu/release/content` (56.5 MB) +- Build timestamp: 2026-07-05 17:26 + +### Acceptance Criteria Status +| Criterion | Status | +|-----------|--------| +| `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 | + +## Artifacts Created +- Restored: `fuzz/fuzz_targets/content.rs` +- Build artifact: `fuzz/target/x86_64-unknown-linux-gnu/release/content` + +## Conclusion +The fuzz harness builds successfully. The missing `content.rs` file was restored from git history. All acceptance criteria are **PASS**.