Commit Graph
21 Commits
Author SHA1 Message Date
aiongg 2df33d2f01 Merge remote-tracking branch 'upstream/main' into sync/main-1116
# Conflicts:
#	Cargo.lock
#	crates/audio/src/lib.rs
#	crates/exr/src/decode.rs
#	crates/font-catalog/src/lib.rs
#	crates/ps/src/lib.rs
#	crates/svg/Cargo.toml
#	crates/text/Cargo.toml
#	crates/text/src/lib.rs
#	crates/video/Cargo.toml
#	crates/video/src/lib.rs
2026-11-16 14:23:07 +00:00
Dylan M. TayloranddotCooCoo a62de6c7c3 exr: integrate mixed deep/flat decoding with regression coverage (#1853)
* EXR: decode a flat part of a file that also holds deep parts

decode_part refused every part of a file with any deep part, and
decode_display_part, which checked only the selected part, still failed
because the exr crate's image reader validates every header and refuses
deep ones before it reads a chunk.

Both now decide from the selected part's own header. When any part is
deep, the selected flat part is read chunk by chunk: the flat headers are
validated, every part's offset table is walked from the end of the
headers, and only the selected table's chunks are read. A chunk must start
past the last offset table and inside the file, carry the selected part's
number and hold a block no other chunk of the part holds; anything else is
Malformed. Files with only flat parts keep the crate's reader.

The file-size ratio check, which was skipped for every part when any part
was deep, now applies to the flat parts of such a file; deep parts are not
counted.

* EXR: a flat part beside a deep part needs a chunk for each of its blocks

The chunk reader for a flat part of a file that also holds deep parts
refused only a second chunk for the same block. A tiled part's chunk that
named a level the part does not have was skipped without decompressing,
so the tile it took the place of had no chunk and the part decoded with
that tile left at zero.

Each chunk now has to hold one of the part's own blocks, taken from the
header, that no other chunk holds; anything else is Malformed. Since a
part has as many chunks as blocks, every block then has a chunk.

The mixed-file tests also run with a tiled flat part, and a new test
names a missing level and a repeated tile.

* EXR: a scan-line chunk beside a deep part must start at its block's first line

The block index of a scan-line chunk is its y offset divided by the
lines a block holds, rounded toward zero. A chunk whose y was not the
first line of a block, or lay up to 15 lines above the data window of
a ZIP part, still named a block and was decoded into it. Such a chunk
is now Malformed.

* EXR: a block too large to address is LimitExceeded instead of a panic

The exr crate bounds a flat chunk by a block's pixels times the bytes a
pixel takes, an unchecked product, before it reads the chunk. A 1 x 1
part with five float channels in 10^9 x 10^9 tiles passed every size
limit, and decode_part and decode_display_part then panicked with an
overflow, for files of flat parts only and for mixed files alike.
read_meta now computes the product with checked arithmetic for each
flat part and returns LimitExceeded when it does not fit in a usize.

* EXR: a chunk beside a deep part must fit the rest of the file

The exr crate allocates a chunk's declared payload, up to the size of a
block, before it reads it. In a mixed file whose flat part has large
tiles, a chunk declaring i32::MAX bytes made a 2 GiB allocation from a
file of a few hundred bytes. read_flat_part_chunks now reads the
declared length first and returns Malformed when it is longer than the
bytes left in the file.

* test(exr): verify mixed-part ratio and display block budgets

* fix(exr): bound mixed-part payload and block bookkeeping allocations

* fix(exr): expose internal ordinal helpers to regression tests

---------

Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
2026-11-16 07:47:06 -05:00
Dylan M. Taylor 731c4f262a Merge pull request #1758 from dotCooCoo/fix/exr-deep-part-tables-end
craft-exr: deep chunk offsets start after every part's offset table
2026-11-16 05:46:49 -05:00
FredApps 33f35d74f8 exr: clamp the scan-line block bound to the part height
A part shorter than its compression's scan-line group (a one-row ZIP16 part) only decodes its
own rows, so the all-channel block bound is min(scan_lines_per_block, layer_h) rows.
2026-11-16 08:38:50 +01:00
FredApps 15aaced60a fix(exr): bound the display decoder by its largest block, not the whole part
decode_display_part refused a part whose data window across all channels
exceeded max_bytes, even when the kept planes fit. The EXR crate decompresses
one block at a time, so bound the largest all-channel block (a tile within the
data window, or one scan-line group across it) instead. Large multi-layer
files whose picture planes fit now decode; the selected-plane and file
capacity checks are unchanged.
2026-11-16 07:47:17 +01:00
aiongg dffc61a7e0 Merge storytold main 832883b5 (sync 16 Nov)
961 upstream commits since 7bb6c900. Resolutions:
- Test-only conflicts: upstream tests from before the base that our side
  cut stay cut; tests new upstream are kept (audio aac/config, layout,
  encode_format; cms lutfile; media mux; print windows_native, ticket;
  update self_update; xml hostile).
- Code our side moved, with upstream's change carried to the new place:
  craft-media mux roll sample groups (mux/boxes.rs) and writer-start
  offsets with overflow checks (mux/progressive.rs); craft-print's
  shrink-to-fit scale guard (sheets/plan.rs); craft-update's nextest
  archive detection (self_update/detect.rs); craft-vectorcraft-format's
  Tail::write_to_with (container.rs); craft-i18n's pedantic fixes
  (bidi.rs, negotiation.rs).
- craft-ui: the old crate's modules stay removed; gpu_test_lock guarded
  their per-test wgpu renderers, which the snapshot kit does not have.
- New upstream tests in crates that build their integration tests into
  the library's test executable are modules of tests/main.rs (audio
  flac_decode and qoa_oracle, cms, docpath, pcraft-format,
  vectorcraft-format).
- The 22 new crates are optional members of the craft facade.
2026-11-16 01:52:09 +00:00
dotCooCoo 90b6cbef8a craft-exr: deep chunk offsets must follow every part's offset table
In a multipart file the chunks start after the offset tables of all
parts. The deep readers in craft-exr and craft-image-codecs took the end
of the deep part's own table as the start of the chunk area, so an
offset into a later part's table passed the chunk-area check and its
bytes were parsed as a chunk.

Both readers now compute where the deep part's table starts and where
the last table ends with checked arithmetic, and refuse a file whose
tables run past its end before reading any offsets. The earlier tables'
sizes are no longer capped or saturated.

Tests build a two-part file from scratch (a deep part and a 1x1 flat
part, in both orders): the deep part decodes as in a single-part file,
an offset into the second table or one byte before the end of the
tables is refused, and a file that ends inside the second table is
refused.
2026-11-15 13:13:48 -08:00
Dylan M. Taylor 4c17e51335 exr: fix RGBA writer lint 2026-11-15 16:23:03 +00:00
Dylan M. Taylor b2edb7ed80 exr: fix compressor test helper lint 2026-11-15 16:16:39 +00:00
Dylan M. Taylor ab37b756cc exr: fix compressor test helper lint 2026-11-15 16:16:31 +00:00
Dylan M. Taylor d55335423a exr: share scanline RGBA writer 2026-11-15 16:11:32 +00:00
Dylan M. Taylor f31e878c6e exr: share ZIP chunk compression 2026-11-15 16:08:57 +00:00
aiongg deeb91802f Lints: doc links, test lint allowances, struct update in tests, wildcard imports, dead code 2026-11-14 02:35:35 +00:00
aiongg 894ecc6390 Lints: unambiguous write doc links, private doc links, contains 2026-11-14 01:58:46 +00:00
Dylan M. Taylor c806ecb09b fix(exr): bound display decoder blocks 2026-11-13 15:40:19 +00:00
Dylan M. Taylor ac20300ca5 Allow clipped EXR data windows beyond display bounds 2026-11-13 15:24:51 +00:00
Dylan M. Taylor 88dc17059c feat(exr): decode selected channels into display planes 2026-11-13 14:15:41 +00:00
Dylan M. Taylor 8693b9181c craft-exr: bounded band-by-band reader for flat scan-line parts from PhotoCraft (stacked on #1001) (#1004)
* craft-exr: bounded part listing, flat decoding and writing (feature decode)

PhotoCraft's exr-crate wrapper (preview check, per-part and total size limits,
file-size plausibility, part ranking, one-part decode) and EffectCraft's
streaming channel filter, as one reader that returns a neutral model: part
headers with text attributes, and the kept channels in their stored type.

* craft-exr: deep data and Cryptomatte samples (feature decode)

PhotoCraft's deep OpenEXR reader (NONE, RLE and ZIPS deep scan lines and
tiles, every allocation admitted against the byte budget) and its flattening,
and its Cryptomatte layer listing and rank decoding, on the decode module.

* craft-exr: bounded band-by-band reader for flat scan-line parts

PhotoCraft's exr_stream decoder: bounded metadata, the offset table, then one
compression block at a time as interleaved f32. Custom chromaticities are
reported instead of refused, so the colour policy stays with the caller.
2026-11-11 20:25:48 -05:00
Dylan M. Taylor 99b5141700 craft-exr: deep data and Cryptomatte samples from PhotoCraft (feature decode, stacked on #992) (#1001)
* craft-exr: bounded part listing, flat decoding and writing (feature decode)

PhotoCraft's exr-crate wrapper (preview check, per-part and total size limits,
file-size plausibility, part ranking, one-part decode) and EffectCraft's
streaming channel filter, as one reader that returns a neutral model: part
headers with text attributes, and the kept channels in their stored type.

* craft-exr: deep data and Cryptomatte samples (feature decode)

PhotoCraft's deep OpenEXR reader (NONE, RLE and ZIPS deep scan lines and
tiles, every allocation admitted against the byte budget) and its flattening,
and its Cryptomatte layer listing and rank decoding, on the decode module.
2026-11-11 20:23:00 -05:00
Dylan M. Taylor 83eb8f4422 craft-exr: bounded part listing, flat decoding and writing (feature decode) (#992)
PhotoCraft's exr-crate wrapper (preview check, per-part and total size limits,
file-size plausibility, part ranking, one-part decode) and EffectCraft's
streaming channel filter, as one reader that returns a neutral model: part
headers with text attributes, and the kept channels in their stored type.
2026-11-11 19:47:07 -05:00
Dylan M. Taylor e43e8663ae craft-exr: channel naming and Cryptomatte (#929)
The OpenEXR naming layer PhotoCraft and EffectCraft each have: layer and
channel names, the channels that make a colour picture, and Cryptomatte IDs,
metadata keys, manifests and rank channels. No decoder dependency; decoding
follows in later changes.
2026-11-11 18:42:54 -05:00