From 1a8922203dd5d7bd9b3aaec83d2c1a636162f21e Mon Sep 17 00:00:00 2001 From: mtlcl410 Date: Thu, 5 Nov 2026 22:09:41 +0800 Subject: [PATCH] M1: the sign discovery test reads a stream with neither endstream nor /Length as unreadable With hayro-syntax patch 36 and its cos counterpart, a stream with no endstream left in the file is the bytes its /Length gives, so the fixture's `<< /Length 0 >>` stream without endstream now reads as an empty stream. The test needs an object that cannot be read: a stream with no /Length either still is one. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Pq7HyDBXygTf7jcqdsjcfn --- crates/sign/src/pdf_discovery_tests.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/sign/src/pdf_discovery_tests.rs b/crates/sign/src/pdf_discovery_tests.rs index 6c0456ac5b..29f115cb07 100644 --- a/crates/sign/src/pdf_discovery_tests.rs +++ b/crates/sign/src/pdf_discovery_tests.rs @@ -172,8 +172,9 @@ fn reconstructed_and_unreadable_objects_are_not_cached_as_complete() { assert_eq!(cache.timestamp_candidates(&repaired), vec![ObjRef::new(3, 0)]); } // A single invalid keyword immediately before endobj is deliberately recovered as - // Null by parse_indirect. Use a stream without endstream to exercise a real read error. - let unreadable = fixture(&[STAMP, "<< /Length 0 >>\nstream\nunterminated"]); + // Null by parse_indirect. Use a stream with neither endstream nor /Length to exercise a real + // read error (with a /Length that fits, the stream is that many bytes). + let unreadable = fixture(&[STAMP, "<< >>\nstream\nunterminated"]); assert!(unreadable.repair_log().is_empty()); assert!(unreadable.try_get(4).is_err()); assert!(unreadable.scan_objects_checked().any(|(r, object)| r.num == 4 && object.is_err()));