redact: the refusal test checks a copy with its filter by reference too

In `a_shared_jbig2_dictionary_that_cant_leave_refuses_the_redaction`, the case of a copy of
the dictionary whose `/Filter` is given by reference may end `Ok`, the image stored again
without it. That branch checked only that the dictionary, object 9, left, and that its marker
was nowhere in the file. But `assert_gone` can't decode the copy, object 10, with its filter by
reference, and its bytes are Flate, so a run that never found the copy, and left it in the
file, passed. The branch now checks that object 10 left too, through `reachable_objects`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
This commit is contained in:
Grzegorz Martens
2026-11-09 16:20:40 +01:00
co-authored by Claude Opus 5.5
parent b9e83d8b67
commit 587d6528b0
+4 -1
View File
@@ -2204,7 +2204,10 @@ fn a_shared_jbig2_dictionary_that_cant_leave_refuses_the_redaction() {
match apply(&mut doc, None) {
Err(RedactError::SharedJbig2Globals(_)) => assert_eq!(drawn_samples(&doc, 0), drawn_samples(&before, 0), "{other}: nothing was redacted"),
Ok(_) if through_reference => {
assert!(!pdfcraft_cos::reachable_objects(&doc).unwrap().contains(&9), "{other}: the dictionary stays");
// Object 10 too, the copy or the reference to the dictionary: `assert_gone` can't
// decode the copy, its `/Filter` given by reference, nor see its bytes, which are Flate.
let kept = pdfcraft_cos::reachable_objects(&doc).unwrap();
assert!(!kept.contains(&9) && !kept.contains(&10), "{other}: the dictionary or its copy stays");
assert_gone(&doc, b"LEAK_GLOBALS");
}
result => panic!("{other}: {result:?}"),