- Verified cargo fuzz build content completes successfully - Confirmed binary exists at fuzz/target/x86_64-unknown-linux-gnu/release/content (54MB) - All acceptance criteria PASS - Harness ready for fuzzing execution Closes bf-1c4f6
2.5 KiB
2.5 KiB
Build content fuzz harness
Task: Build the content fuzz harness Bead: bf-1c4f6 Date: 2025-07-05
Work Completed
1. Added content target to fuzz/Cargo.toml
The content.rs fuzz target was not listed in fuzz/Cargo.toml. Added the following:
[[bin]]
name = "content"
path = "fuzz_targets/content.rs"
2. Fixed build script issue
The build script crates/pdftract-core/build.rs had an issue where the font fingerprint phf map was declared with [u8; 32] keys but was being built with string representations.
Fix:
- Changed from byte array keys to hex string keys
- Updated
phf::Map<[u8; 32], ...>tophf::Map<&'static str, ...> - Modified the key generation to use hex strings directly
- Added documentation explaining the hex string lookup approach
3. Updated fingerprint.rs for hex string lookups
Modified crates/pdftract-core/src/font/fingerprint.rs:
- Added
as_hex_string()method toFontFingerprintto convert[u8; 32]to hex string - Updated
lookup_font_fingerprint()to use hex string lookup - Updated
CachedFingerprint::from_font_program()to use hex string lookup - Updated
CachedFingerprint::lookup()to use hex string lookup
4. Build verification
- Command:
cargo fuzz build content - Result: SUCCESS - 54MB binary produced
- Binary location:
/home/coding/pdftract/fuzz/target/x86_64-unknown-linux-gnu/release/content - Compilation errors: None
- Compilation warnings: None (that would prevent execution)
Files Modified
fuzz/Cargo.toml- Added content targetcrates/pdftract-core/build.rs- Fixed font fingerprint generationcrates/pdftract-core/src/font/fingerprint.rs- Updated for hex string lookups
Acceptance Criteria
- ✅
cargo fuzz build contentcompletes successfully - ✅ No compilation errors or warnings that would prevent execution
- ✅ Harness binary is built and available (54MB)
Final Verification (2026-07-05)
Re-verified the build is still working correctly:
- Command:
cargo fuzz build content - Result: BUILD SUCCESS
- Binary verified:
/home/coding/pdftract/fuzz/target/x86_64-unknown-linux-gnu/release/content(54MB, executable) - cargo-fuzz: Installed at
/home/coding/.cargo/bin/cargo-fuzz
The harness remains ready for fuzzing execution.
Notes
The content fuzz harness tests INV-8 (no panic at public boundary) for the content stream interpreter. The harness runs the interpreter on both Normal and PositionHint processing modes with arbitrary input data, ensuring no panics occur on any input.