mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-25 10:39:01 -06:00
* fix(redact): size image clearing with checked arithmetic (#2177) An ICCBased image's /N comes from the file and was cast with `as usize`, then multiplied unchecked into the row size. /N 2^60 overflowed it (debug: overflow panic; release: a zero row emptied the buffer and the write loop indexed out of bounds), and a negative /N wrapped. /N is now limited to 1, 3 or 4 (ISO 32000-2 §8.6.5.5), every size product is checked, and the pixel writes use `get_mut`. An image that fails any of these is refused, and the caller already removes it whole (fail-closed). Regression test covers /N 2^60, -1 and 2. * redact tests: pass the pixel array by value (clippy needless_borrows_for_generic_args) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Brandon Thomas <echelon@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>