fix(edit): require intact streams when identifying page backdrops

This commit is contained in:
FredApps
2026-10-30 13:21:04 +01:00
parent 25f3d12960
commit 673178b70c
+3 -1
View File
@@ -379,7 +379,9 @@ fn scan(doc: &Document, p: &pdfcraft_model::Page, swap: Option<(ObjRef, &[u8])>)
}
let bytes = match swap {
Some((with, b)) if with == *r => b.to_vec(),
_ => s.decoded().ok()?,
// Tolerant decoding can return an empty or partial stream after corruption.
// That cannot prove which paint preceded the candidate backdrop.
_ => s.decoded_strict().ok()?,
};
starts.push(total);
total = total.saturating_add(bytes.len()).saturating_add(1);