Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Large PSBs open with their pixels: decode planes past 2 GiB, plus 4-5 GB PSB fixtures (#375) (#782)

alexanderalber8948511eeb75
diff --git a/crates/io/examples/big_psb_check.rs b/crates/io/examples/big_psb_check.rs
new file mode 100644
index 000000000..9b1eb80d4
--- /dev/null
+++ b/crates/io/examples/big_psb_check.rs
@@ -0,0 +1,84 @@
+//! Opens the files written by `photocraft-psd`'s `big_psb` example and checks their pixels.
+//!
+//! `cargo run --release -p photocraft-io --example big_psb_check -- <file.psb>...`
+
+fn sample(x: u32, y: u32, c: u32, rle: bool) -> u8 {
+ if c == 3 {
+ return 255;
+ }
+ let x = if rle { 0 } else { x };
+ (x.wrapping_mul(7).wrapping_add(y.wrapping_mul(13)).wrapping_add(c.wrapping_mul(101)) & 0xff) as u8
+}
+
+fn main() {
+ for path in std::env::args().skip(1) {
+ let rle = path.contains("rle");
+ let t = std::time::Instant::now();
+ let bytes = match std::fs::read(&path) {
+ Ok(b) => b,
+ Err(e) => {
+ println!("{path}: read failed: {e}");
+ continue;
+ }
+ };
+ let read_s = t.elapsed().as_secs_f64();
+ let t = std::time::Instant::now();
+ let res = match photocraft_io::import(&path, &bytes) {
+ Ok(r) => r,
+ Err(e) => {
+ println!("{path}: import failed: {e}");
+ continue;
+ }
+ };
+ drop(bytes);
+ // With SAVE set: save as PSB, then check the re-opened file instead.
+ let res = if std::env::var_os("SAVE").is_some() {
+ let t = std::time::Instant::now();
+ let out = match photocraft_io::export(&res.document, "x.psb", &photocraft_io::ExportOptions::default()) {
+ Ok(o) => o,
+ Err(e) => {
+ println!("{path}: save failed: {e}");
+ continue;
+ }
+ };
+ println!("{path}: saved {:.2} GB in {:.1} s, warnings {:?}", out.bytes.len() as f64 / 1e9, t.elapsed().as_secs_f64(), out.warnings);
+ drop(res);
+ match photocraft_io::import("x.psb", &out.bytes) {
+ Ok(r) => r,
+ Err(e) => {
+ println!("{path}: re-open failed: {e}");
+ continue;
+ }
+ }
+ } else {
+ res
+ };
+ let doc = &res.document;
+ println!(
+ "{path}: read {read_s:.1} s, import {:.1} s, {}x{}, {} layer(s)",
+ t.elapsed().as_secs_f64(),
+ doc.size.width,
+ doc.size.height,
+ doc.layers.len()
+ );
+ for w in &res.warnings {
+ println!(" warning: {w}");
+ }
+ let Some(s) = doc.layers.first().and_then(|l| l.surface()) else {
+ println!(" FAIL: no pixel layer");
+ continue;
+ };
+ let (w, h) = (doc.size.width, doc.size.height);
+ let mut bad = 0;
+ let points = [(0, 0), (w - 1, 0), (0, h - 1), (w - 1, h - 1), (w / 2, h / 2), (w / 3, h * 2 / 3), (12_345 % w, (h - 7) % h)];
+ for &(x, y) in &points {
+ let got = s.pixel(x as i32, y as i32);
+ let want: Vec<f32> = (0..4).map(|c| f32::from(sample(x, y, c, rle)) / 255.0).collect();
+ if got.len() != 4 || got.iter().zip(&want).any(|(g, w)| (g - w).abs() > 1.0 / 510.0) {
+ bad += 1;
+ println!(" mismatch at ({x}, {y}): got {got:?}, want {want:?}");
+ }
+ }
+ println!(" {}", if bad == 0 { "OK: all sampled pixels match" } else { "FAIL" });
+ }
+}
diff --git a/crates/io/src/psd_import.rs b/crates/io/src/psd_import.rs
index 2b1ab3f0c..699bcb5e2 100644
--- a/crates/io/src/psd_import.rs
+++ b/crates/io/src/psd_import.rs
@@ -127,6 +127,12 @@ impl Ctx<'_> {
planes.push(self.channel_plane(rec, c as i16, name));
}
planes.push(self.channel_plane(rec, CHANNEL_TRANSPARENCY, name));
+ // A channel that is in the file but could not be decoded leaves the layer empty, as the
+ // warning says. Filling in for it would paint an opaque black layer over the document.
+ let ids = (0..self.cc as i16).chain([CHANNEL_TRANSPARENCY]);
+ if ids.zip(&planes).any(|(id, p)| p.is_none() && rec.channel(id).is_some()) {
+ return Surface::new(self.fmt);
+ }
let refs: Vec<Option<&[u8]>> = planes.iter().map(|p| p.as_deref()).collect();
let mut fill: Vec<Vec<u8>> = vec![zero_sample(s); self.cc];
fill.push(max_sample(s));
diff --git a/crates/io/tests/large_psb.rs b/crates/io/tests/large_psb.rs
new file mode 100644
index 000000000..bcde955bd
--- /dev/null
+++ b/crates/io/tests/large_psb.rs
@@ -0,0 +1,50 @@
+//! Large PSB files (#375): planes past 2 GiB decode, and a channel that can't be decoded leaves
+//! its layer empty instead of painting it opaque black.
+
+use photocraft_io::psd_to_document;
+use photocraft_psd::testgen;
+use photocraft_psd::{ColorMode, Compression, LayerSpec, PixelData, PsdBuilder, Version};
+
+/// A layer whose red channel is damaged: the warning says "treated as empty", and the layer must
+/// be empty, not opaque black (the transparency channel is still fine).
+#[test]
+fn undecodable_channel_leaves_the_layer_empty() {
+ for version in [Version::Psd, Version::Psb] {
+ let mut b = PsdBuilder::new(4, 4).version(version).compression(Compression::Rle);
+ b.push_layer(LayerSpec::new("Damaged", 0, 0, 4, 4, PixelData::Rgba8(vec![200; 64])));
+ let mut file = b.build().unwrap();
+ let red = file.layers_mut()[0].channels.iter_mut().find(|c| c.id == 0).unwrap();
+ red.data.truncate(1);
+
+ let (doc, warnings) = psd_to_document(&file);
+ assert!(warnings.iter().any(|w| w.contains("Damaged") && w.contains("could not be decoded")), "{warnings:?}");
+ let s = doc.layers[0].surface().unwrap();
+ assert_eq!(s.pixel(1, 1)[3], 0.0, "{version:?}: the damaged layer must be transparent");
+ }
+}
+
+/// A flattened 29000² RGB PSB: its merged image decodes to 2.52 GB, past the old 2 GiB cap, which
+/// opened it as a document with no layers. Needs about 12 GB of memory, so it is opt-in:
+/// `cargo test --release -p photocraft-io --test large_psb -- --ignored`.
+#[test]
+#[ignore = "allocates ~12 GB; run in release"]
+fn flattened_psb_with_a_merged_image_over_2_gib_opens() {
+ const SIDE: u32 = 29_000;
+ let file = testgen::merged_only(Version::Psb, ColorMode::Rgb, 8, Compression::Rle, SIDE, SIDE);
+ assert!(!file.image_data.data.is_empty(), "the generator could not encode the merged image");
+
+ let (doc, warnings) = psd_to_document(&file);
+ assert!(warnings.is_empty(), "{warnings:?}");
+ assert_eq!(doc.layers.len(), 1);
+ let s = doc.layers[0].surface().unwrap();
+ // testgen::pattern_plane at 8 bits, channel c seeded with c.
+ let want = |x: usize, y: usize, c: usize| if (x / 4 + y).is_multiple_of(3) { (c * 17) as u8 } else { (x * 3 + y * 7 + c) as u8 };
+ let side = SIDE as usize;
+ for (x, y) in [(0, 0), (side - 1, 0), (side / 2, side / 2), (side - 2, side - 1)] {
+ let got = s.pixel(x as i32, y as i32);
+ for (c, v) in got.iter().take(3).enumerate() {
+ assert_eq!((v * 255.0).round() as u8, want(x, y, c), "({x}, {y}) channel {c}");
+ }
+ assert_eq!(got[3], 1.0);
+ }
+}
diff --git a/crates/psd/examples/big_psb.rs b/crates/psd/examples/big_psb.rs
new file mode 100644
index 000000000..332936c1e
--- /dev/null
+++ b/crates/psd/examples/big_psb.rs
@@ -0,0 +1,186 @@
+//! Writes multi-gigabyte PSB files for large-file tests (#375, #216), straight from the Adobe
+//! PSD spec and independent of this crate's writer, so the fixtures don't inherit its limits.
+//!
+//! `cargo run --release -p photocraft-psd --example big_psb -- <out dir> [case...]`
+//!
+//! Every sample follows [`sample`], so a reader can check any pixel without the file. RLE cases
+//! keep each row constant (tiny files, full decoded size); raw cases vary along x too.
+
+use std::fs::File;
+use std::io::{self, BufWriter, Write};
+use std::path::Path;
+
+/// One generated file.
+struct Case {
+ name: &'static str,
+ width: u32,
+ height: u32,
+ depth: u16,
+ /// Raw (0) or RLE (1).
+ rle: bool,
+ /// One full-canvas RGBA layer, or a flattened file (composite only).
+ layered: bool,
+}
+
+const CASES: &[Case] = &[
+ // Composite of 2.52 GB in one decode.
+ Case { name: "flat8-29k-rle", width: 29_000, height: 29_000, depth: 8, rle: true, layered: false },
+ // A 4.8 GB file: offsets past 4 GiB, composite of 4.8 GB.
+ Case { name: "flat8-40k-raw", width: 40_000, height: 40_000, depth: 8, rle: false, layered: false },
+ // 4.38 GB file: layer channels of 625 MB, composite of 1.9 GB, data past 4 GiB.
+ Case { name: "layer8-25k-raw", width: 25_000, height: 25_000, depth: 8, rle: false, layered: true },
+ // Layer channels of 900 MB, composite of 2.7 GB.
+ Case { name: "layer8-30k-rle", width: 30_000, height: 30_000, depth: 8, rle: true, layered: true },
+ // Layer channels of 2.18 GB each.
+ Case { name: "layer16-33k-rle", width: 33_000, height: 33_000, depth: 16, rle: true, layered: true },
+];
+
+/// The 8-bit sample of channel `c` (0..3 colour, 3 = alpha) at (`x`, `y`). RLE files ignore `x`.
+/// 16-bit files store `v * 257`.
+pub fn sample(x: u32, y: u32, c: u32, rle: bool) -> u8 {
+ if c == 3 {
+ return 255;
+ }
+ let x = if rle { 0 } else { x };
+ (x.wrapping_mul(7).wrapping_add(y.wrapping_mul(13)).wrapping_add(c.wrapping_mul(101)) & 0xff) as u8
+}
+
+fn main() -> io::Result<()> {
+ let args: Vec<String> = std::env::args().skip(1).collect();
+ let out = args.first().map_or_else(|| std::env::temp_dir().join("photocraft-big-psb"), std::path::PathBuf::from);
+ std::fs::create_dir_all(&out)?;
+ let wanted = args.get(1..).unwrap_or(&[]);
+ for case in CASES.iter().filter(|c| wanted.is_empty() || wanted.iter().any(|w| w == c.name)) {
+ let path = out.join(format!("{}.psb", case.name));
+ let t = std::time::Instant::now();
+ write_case(case, &path)?;
+ let len = std::fs::metadata(&path)?.len();
+ println!("{}: {:.2} GB in {:.1} s", path.display(), len as f64 / 1e9, t.elapsed().as_secs_f64());
+ }
+ Ok(())
+}
+
+fn row_bytes(c: &Case) -> u64 {
+ u64::from(c.width) * u64::from(c.depth / 8)
+}
+
+/// PackBits for a row of `n` equal bytes: runs of 128, then the remainder.
+fn rle_row(n: u64, b: u8) -> Vec<u8> {
+ let mut v = Vec::new();
+ let mut left = n;
+ while left > 0 {
+ let run = left.min(128);
+ if run == 1 {
+ v.extend_from_slice(&[0, b]);
+ } else {
+ v.extend_from_slice(&[(257 - run) as u8, b]);
+ }
+ left -= run;
+ }
+ v
+}
+
+/// The bytes of one row of channel `ch`.
+fn row(c: &Case, y: u32, ch: u32, buf: &mut Vec<u8>) {
+ buf.clear();
+ if c.rle {
+ buf.extend(rle_row(row_bytes(c), sample(0, y, ch, true)));
+ return;
+ }
+ for x in 0..c.width {
+ let s = sample(x, y, ch, false);
+ buf.push(s);
+ if c.depth == 16 {
+ buf.push(s);
+ }
+ }
+}
+
+/// Size of a channel block (compression word, RLE counts, rows) of `planes` planes.
+fn channel_len(c: &Case, planes: u64) -> u64 {
+ let rows = planes * u64::from(c.height);
+ if c.rle { 2 + rows * 4 + rows * rle_row(row_bytes(c), 0).len() as u64 } else { 2 + rows * row_bytes(c) }
+}
+
+/// Writes the compression word, the counts and the rows of `chans`.
+fn write_planes(w: &mut impl Write, c: &Case, chans: &[u32]) -> io::Result<()> {
+ w.write_all(&u16::from(c.rle).to_be_bytes())?;
+ if c.rle {
+ let n = rle_row(row_bytes(c), 0).len() as u32;
+ for _ in 0..chans.len() as u64 * u64::from(c.height) {
+ w.write_all(&n.to_be_bytes())?;
+ }
+ }
+ let mut buf = Vec::new();
+ for &ch in chans {
+ for y in 0..c.height {
+ row(c, y, ch, &mut buf);
+ w.write_all(&buf)?;
+ }
+ }
+ Ok(())
+}
+
+fn write_case(c: &Case, path: &Path) -> io::Result<()> {
+ let mut w = BufWriter::with_capacity(8 << 20, File::create(path)?);
+ // Header: PSB (version 2), 3 channels, RGB.
+ w.write_all(b"8BPS")?;
+ w.write_all(&2u16.to_be_bytes())?;
+ w.write_all(&[0; 6])?;
+ w.write_all(&3u16.to_be_bytes())?;
+ w.write_all(&c.height.to_be_bytes())?;
+ w.write_all(&c.width.to_be_bytes())?;
+ w.write_all(&c.depth.to_be_bytes())?;
+ w.write_all(&3u16.to_be_bytes())?;
+ // Colour mode data and image resources: empty.
+ w.write_all(&0u32.to_be_bytes())?;
+ w.write_all(&0u32.to_be_bytes())?;
+
+ if c.layered {
+ // Transparency (-1), then R, G, B: one block per channel.
+ let ids: [(i16, u32); 4] = [(-1, 3), (0, 0), (1, 1), (2, 2)];
+ let ch_len = channel_len(c, 1);
+ let name = b"Layer 1";
+ let mut rec = Vec::new();
+ for v in [0i32, 0, c.height as i32, c.width as i32] {
+ rec.extend_from_slice(&v.to_be_bytes());
+ }
+ rec.extend_from_slice(&4u16.to_be_bytes());
+ for (id, _) in ids {
+ rec.extend_from_slice(&id.to_be_bytes());
+ rec.extend_from_slice(&ch_len.to_be_bytes());
+ }
+ rec.extend_from_slice(b"8BIMnorm");
+ rec.extend_from_slice(&[255, 0, 0, 0]);
+ // Extra data: no mask, no blending ranges, the Pascal name padded to 4.
+ let mut extra = Vec::new();
+ extra.extend_from_slice(&0u32.to_be_bytes());
+ extra.extend_from_slice(&0u32.to_be_bytes());
+ extra.push(name.len() as u8);
+ extra.extend_from_slice(name);
+ while extra.len() % 4 != 0 {
+ extra.push(0);
+ }
+ rec.extend_from_slice(&(extra.len() as u32).to_be_bytes());
+ rec.extend_from_slice(&extra);
+
+ let mut layer_info = 2 + rec.len() as u64 + 4 * ch_len;
+ let pad = layer_info % 2;
+ layer_info += pad;
+ // Layer and mask information: layer info (8-byte length) + empty global mask (4 bytes).
+ w.write_all(&(8 + layer_info + 4).to_be_bytes())?;
+ w.write_all(&layer_info.to_be_bytes())?;
+ w.write_all(&1i16.to_be_bytes())?;
+ w.write_all(&rec)?;
+ for (_, ch) in ids {
+ write_planes(&mut w, c, &[ch])?;
+ }
+ w.write_all(&vec![0; pad as usize])?;
+ w.write_all(&0u32.to_be_bytes())?;
+ } else {
+ w.write_all(&0u64.to_be_bytes())?;
+ }
+ // The merged image.
+ write_planes(&mut w, c, &[0, 1, 2])?;
+ w.flush()
+}
diff --git a/crates/psd/src/compression.rs b/crates/psd/src/compression.rs
index b2d6d55c2..a8fa0f426 100644
--- a/crates/psd/src/compression.rs
+++ b/crates/psd/src/compression.rs
@@ -10,9 +10,16 @@ use crate::error::{PsdError, Result};
use crate::header::{Version, row_bytes};
use crate::io::{Reader, WriteExt};
-/// Maximum number of decoded bytes a single decode call may produce. Guards
-/// against decompression bombs from tiny inputs.
-pub const MAX_DECODED_BYTES: u64 = 1 << 31;
+/// Maximum number of decoded bytes a single decode call may produce: 8 GiB on
+/// 64-bit targets, 2 GiB elsewhere (the same budget as `photocraft-codecs`'
+/// default `Limits::max_alloc`).
+///
+/// The decoders bound their output by their input on their own (RLE expands
+/// at most 64x, Raw needs every byte present), so this is a backstop against
+/// decompression bombs, not the main guard. It has to fit real PSBs: a
+/// 30000² RGB merged image is 2.7 GB, and a 33000² 16-bit layer channel is
+/// 2.2 GB, both of which a 2 GiB cap turned into empty layers (#375).
+pub const MAX_DECODED_BYTES: u64 = if cfg!(target_pointer_width = "64") { 8 << 30 } else { 2 << 30 };
/// Compression method stored before channel / image data.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -201,7 +208,10 @@ pub fn decode_planes(compression: Compression, data: &[u8], layout: &PlaneLayout
if data.len() < total {
return Err(PsdError::UnexpectedEof { offset: data.len(), needed: total - data.len() });
}
- Ok(data[..total].to_vec())
+ let mut out = Vec::new();
+ out.try_reserve_exact(total).map_err(|_| PsdError::LimitExceeded("not enough memory for the decoded channel data"))?;
+ out.extend_from_slice(&data[..total]);
+ Ok(out)
}
Compression::Rle => decode_rle(data, layout, total),
Compression::Zip => zip_decompress(data, total),
@@ -302,7 +312,9 @@ fn decode_rle(data: &[u8], layout: &PlaneLayout, total: usize) -> Result<Vec<u8>
if (total as u64) > (r.remaining() as u64).saturating_mul(64) {
return Err(PsdError::Decompress("RLE data too short for declared size".into()));
}
- let mut out = Vec::with_capacity(total);
+ // Up to MAX_DECODED_BYTES: report a machine without that much memory instead of aborting.
+ let mut out = Vec::new();
+ out.try_reserve_exact(total).map_err(|_| PsdError::LimitExceeded("not enough memory for the decoded channel data"))?;
for c in counts {
let row = r.bytes(c)?;
packbits::decode_into(row, rb, &mut out)?;
@@ -342,10 +354,29 @@ pub fn zip_compress(data: &[u8]) -> Vec<u8> {
/// Decompresses a zlib stream, requiring at least `expected` output bytes and
/// returning exactly `expected`.
+///
+/// The output is reserved fallibly and read in chunks, never past `expected`
+/// bytes, so a stream declaring a huge size reports an error on a machine
+/// without that much memory instead of aborting.
pub fn zip_decompress(data: &[u8], expected: usize) -> Result<Vec<u8>> {
- let dec = flate2::read::ZlibDecoder::new(data);
- let mut out = Vec::with_capacity(expected.min(data.len().saturating_mul(1032)));
- dec.take(expected as u64).read_to_end(&mut out).map_err(|e| PsdError::Decompress(e.to_string()))?;
+ const OOM: PsdError = PsdError::LimitExceeded("not enough memory for the decoded channel data");
+ const CHUNK: usize = 1 << 20;
+ let mut dec = flate2::read::ZlibDecoder::new(data).take(u64::try_from(expected).unwrap_or(u64::MAX));
+ let mut out = Vec::new();
+ // Deflate expands at most ~1032:1, so this is the most a valid stream can need.
+ out.try_reserve_exact(expected.min(data.len().saturating_mul(1032))).map_err(|_| OOM)?;
+ let mut buf = vec![0u8; CHUNK.min(expected).max(1)];
+ loop {
+ let n = match dec.read(&mut buf) {
+ Ok(0) => break,
+ Ok(n) => n,
+ Err(e) if e.kind() == std::io::ErrorKind::Interrupted => continue,
+ Err(e) => return Err(PsdError::Decompress(e.to_string())),
+ };
+ let chunk = buf.get(..n).ok_or_else(|| PsdError::Decompress("zlib reader overran its buffer".into()))?;
+ out.try_reserve(n).map_err(|_| OOM)?;
+ out.extend_from_slice(chunk);
+ }
if out.len() < expected {
return Err(PsdError::Decompress(format!("zlib stream produced {} of {} bytes", out.len(), expected)));
}
@@ -453,6 +484,34 @@ mod tests {
enc
}
+ #[test]
+ fn zip_absurd_declared_size_is_an_error() {
+ let z = zip_compress(&[7u8; 64]);
+ for expected in [1usize << 40, usize::MAX / 2, usize::MAX] {
+ assert!(zip_decompress(&z, expected).is_err(), "expected {expected}");
+ }
+ // Through decode_planes: a tiny ZIP channel claiming a huge (but capped) plane.
+ let l = layout(1, 1 << 16, 1 << 15, 8, Version::Psb);
+ assert!(decode_planes(Compression::Zip, &z, &l).is_err());
+ assert!(decode_planes(Compression::ZipPrediction, &z, &l).is_err());
+ // Past MAX_DECODED_BYTES.
+ let l = layout(4, 1 << 20, 1 << 20, 32, Version::Psb);
+ assert!(decode_planes(Compression::Zip, &z, &l).is_err());
+ // Garbage that is not zlib at all.
+ assert!(zip_decompress(&[0xff; 16], 1 << 30).is_err());
+ }
+
+ #[test]
+ fn zip_decompress_exact_and_truncated() {
+ let src: Vec<u8> = (0..3_000_000u32).map(|i| (i % 251) as u8).collect();
+ let z = zip_compress(&src);
+ assert_eq!(zip_decompress(&z, src.len()).unwrap(), src);
+ // Asking for fewer bytes returns exactly that many.
+ assert_eq!(zip_decompress(&z, 1000).unwrap(), &src[..1000]);
+ assert!(zip_decompress(&z, src.len() + 1).is_err());
+ assert!(zip_decompress(&z, 0).unwrap().is_empty());
+ }
+
#[test]
fn packbits_empty() {
assert!(pb_roundtrip(&[]).is_empty());
@@ -644,6 +703,16 @@ mod tests {
assert!(decode_planes(Compression::Rle, &[0; 16], &l).is_err());
}
+ /// Real PSBs go past 2 GiB in one decode (#375): a 30000² RGB merged image and a 33000²
+ /// 16-bit layer channel. Only checks the limit, so nothing is allocated.
+ #[test]
+ #[cfg(target_pointer_width = "64")]
+ fn decoded_len_allows_large_psb_planes() {
+ assert_eq!(layout(3, 30_000, 30_000, 8, Version::Psb).decoded_len().unwrap(), 2_700_000_000);
+ assert_eq!(layout(1, 33_000, 33_000, 16, Version::Psb).decoded_len().unwrap(), 2_178_000_000);
+ assert!(layout(4, 40_000, 40_000, 16, Version::Psb).decoded_len().is_err());
+ }
+
#[test]
fn prediction_8bit_known_vector() {
let l = layout(1, 4, 1, 8, Version::Psd);
diff --git a/docs/scorecard.md b/docs/scorecard.md
index 6c2c03107..931edb77f 100644
--- a/docs/scorecard.md
+++ b/docs/scorecard.md
@@ -7,7 +7,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js
| Area | Done | Partial | Missing | Key numbers |
|---|---:|---:|---:|---|
| [Performance](#performance) | 3 | 22 | 13 | 47 scenarios: 3 within budget, 22 over budget or failing, 15 tracked only, 6 not run, 7 not measurable yet (baseline 2026-10-05) |
-| [File compatibility](#file-compatibility) | 2 | 8 | 17 | io corpus: oracle ≥ 146/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 229/309, round trip ≥ 307/309; photoshop oracles: oracle ≥ 132/256, round trip ≥ 258/256 |
+| [File compatibility](#file-compatibility) | 2 | 9 | 16 | io corpus: oracle ≥ 146/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 229/309, round trip ≥ 307/309; photoshop oracles: oracle ≥ 132/256, round trip ≥ 258/256 |
| [Tools](#tools) | 6 | 14 | 10 | |
| [Workspace and UI](#workspace-and-ui) | 0 | 5 | 18 | settings that do nothing: 57 of 135 (target 0) |
| [Type](#type) | 0 | 3 | 6 | |
@@ -111,7 +111,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t
| FILE-215-20 | Artboard tool with handles and + buttons, Duplicate Artboard beside, vector PDF pages | partial | [#215](https://github.com/storytold/photocraft/issues/215) | artboard_ui.rs:1 names/properties only; no tool, + buttons or duplicate |
| FILE-215-21 | Local libraries of colours, patterns, images and layers, as linked items or copies | missing | [#215](https://github.com/storytold/photocraft/issues/215) | Only preset libraries (preset_store.rs) |
| FILE-216-1 | Every corpus fetched and enforced in CI, cached by pin | missing | [#216](https://github.com/storytold/photocraft/issues/216) | No corpus step in ci.yml; in progress in #190 |
-| FILE-216-2 | Large-file fixtures: 20 MP, 150-layer, generated 2 GB PSD and 4-5 GB PSB stress tests | missing | [#216](https://github.com/storytold/photocraft/issues/216) | Only banded.rs covers a >8 MP synthetic export |
+| FILE-216-2 | Large-file fixtures: 20 MP, 150-layer, generated 2 GB PSD and 4-5 GB PSB stress tests | partial | [#216](https://github.com/storytold/photocraft/issues/216) | 4-5 GB PSB fixtures: psd example big_psb writes them (raw and RLE, planes past 2 GiB), io example big_psb_check opens and checks them; opt-in io tests/large_psb.rs (2.5 GB merged image). No 2 GB PSD, 150-layer or 20 MP fixture, nothing in CI |
| FILE-216-3 | TIFF, RAW and EXR corpora read by tests; per-camera RAW coverage reported | missing | [#216](https://github.com/storytold/photocraft/issues/216) | corpus/tiff, raw and exr only listed by xtask corpus; no test reads them |
| FILE-216-4 | Exports re-open in a third-party oracle editor | missing | [#216](https://github.com/storytold/photocraft/issues/216) | The round trip is our export -> our import |
| FILE-216-5 | Save-path tests: layered TIFF, PDF, SVG, ACO/ASE, .shc, Smart Filters, atomic-save failure | missing | [#216](https://github.com/storytold/photocraft/issues/216) | Features absent; no atomic-save failure-injection test |
diff --git a/scorecard/file_compat.toml b/scorecard/file_compat.toml
index 8a011f715..3a5599865 100644
--- a/scorecard/file_compat.toml
+++ b/scorecard/file_compat.toml
@@ -162,9 +162,9 @@ note = "No corpus step in ci.yml; in progress in #190"
[[item]]
id = "FILE-216-2"
target = "Large-file fixtures: 20 MP, 150-layer, generated 2 GB PSD and 4-5 GB PSB stress tests"
-status = "missing"
+status = "partial"
issue = 216
-note = "Only banded.rs covers a >8 MP synthetic export"
+note = "4-5 GB PSB fixtures: psd example big_psb writes them (raw and RLE, planes past 2 GiB), io example big_psb_check opens and checks them; opt-in io tests/large_psb.rs (2.5 GB merged image). No 2 GB PSD, 150-layer or 20 MP fixture, nothing in CI"
[[item]]
id = "FILE-216-3"