Skip to content

Fix exrmultipart -convert on tiled and deep single-part files - #2823

Merged
cary-ilm merged 2 commits into
AcademySoftwareFoundation:mainfrom
cary-ilm:fix-2820-convert-tiled-deep
Nov 8, 2026
Merged

cary-ilm merged 2 commits into
AcademySoftwareFoundation:mainfrom
cary-ilm:fix-2820-convert-tiled-deep

Conversation

@cary-ilm

@cary-ilm cary-ilm commented Nov 7, 2026

Copy link
Copy Markdown
Member

exrmultipart -convert rejected any single-part input that was not a plain scanline image:

Cannot initialize output part "0".
Can't build a OutputFile from a type-mismatched part.

convert() reads and writes pixels through the scanline-only InputPart and OutputPart wrappers. OutputPart's constructor calls getOutputPart(), and the OutputFile-from-part constructor throws on any part whose type is not scanlineimage, so a tiled or deep input failed before a single pixel was copied, even though MultiPartOutputFile itself accepts tiled and deep headers.

Unlike -combine/-separate, convert() also remaps channels into multiple output parts by view (SplitChannels), and that remapping is inherently scanline-oriented. But a non-multiview file maps to a single output part, where -convert is just a faithful re-container into EXR-2.0 with no channel remapping. Detect that case and copy the part with the same type-appropriate copy_* helpers -combine and -separate use (copy_tile / copy_scanlinedeep / copy_tiledeep), covering tiled, deep scanline and deep tiled inputs.

The only case left unsupported is splitting the views of a tiled or deep file into multiple parts, which the scanline copy path cannot express; that now fails early with a clear message instead of the type-mismatch error.

Add tiled and deep cases to the exrmultipart CLI test, converting the WavyLinesLatLong.exr and 42.deep.exr fixtures and confirming the output preserves the input's pixel type.

Fixes #2820

Assisted-by: Copilot / Claude Opus 4.8

@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: cary-ilm / name: Cary Phillips (9676880)

@cary-ilm
cary-ilm requested a review from peterhillman November 7, 2026 05:42
exrmultipart -convert rejected any single-part input that was not a
plain scanline image:

  Cannot initialize output part "0".
  Can't build a OutputFile from a type-mismatched part.

convert() reads and writes pixels through the scanline-only InputPart
and OutputPart wrappers. OutputPart's constructor calls
getOutputPart<OutputFile>(), and the OutputFile-from-part constructor
throws on any part whose type is not scanlineimage, so a tiled or deep
input failed before a single pixel was copied, even though
MultiPartOutputFile itself accepts tiled and deep headers.

Unlike -combine/-separate, convert() also remaps channels into multiple
output parts by view (SplitChannels), and that remapping is inherently
scanline-oriented. But a non-multiview file maps to a single output
part, where -convert is just a faithful re-container into EXR-2.0 with
no channel remapping. Detect that case and copy the part with the same
type-appropriate copy_* helpers -combine and -separate use
(copy_tile / copy_scanlinedeep / copy_tiledeep), covering tiled, deep
scanline and deep tiled inputs.

The only case left unsupported is splitting the views of a tiled or
deep file into multiple parts, which the scanline copy path cannot
express; that now fails early with a clear message instead of the
type-mismatch error.

Add tiled and deep cases to the exrmultipart CLI test, converting the
WavyLinesLatLong.exr and 42.deep.exr fixtures and confirming the output
preserves the input's pixel type.

Fixes AcademySoftwareFoundation#2820

Assisted-by: Copilot / Claude Opus 4.8

Signed-off-by: Cary Phillips <seabeepea@gmail.com>
@cary-ilm
cary-ilm force-pushed the fix-2820-convert-tiled-deep branch from 33d8a88 to 9676880 Compare November 7, 2026 05:44

@peterhillman peterhillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for now.
I think it shouldn't be too involved to support regular (non-deep) tiled files too. exrmetrics has code to read and write all tiles of an image that could be adapted here. That would be a "good first issue"

@cary-ilm

cary-ilm commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

Filed #2825. That's clearer and leaving #2820 open.

@cary-ilm
cary-ilm merged commit aa0f55c into AcademySoftwareFoundation:main Nov 8, 2026
39 of 40 checks passed
@cary-ilm cary-ilm added the v3.5 label Nov 8, 2026
cary-ilm added a commit that referenced this pull request Nov 9, 2026
exrmultipart -convert rejected any single-part input that was not a
plain scanline image:

  Cannot initialize output part "0".
  Can't build a OutputFile from a type-mismatched part.

convert() reads and writes pixels through the scanline-only InputPart
and OutputPart wrappers. OutputPart's constructor calls
getOutputPart<OutputFile>(), and the OutputFile-from-part constructor
throws on any part whose type is not scanlineimage, so a tiled or deep
input failed before a single pixel was copied, even though
MultiPartOutputFile itself accepts tiled and deep headers.

Unlike -combine/-separate, convert() also remaps channels into multiple
output parts by view (SplitChannels), and that remapping is inherently
scanline-oriented. But a non-multiview file maps to a single output
part, where -convert is just a faithful re-container into EXR-2.0 with
no channel remapping. Detect that case and copy the part with the same
type-appropriate copy_* helpers -combine and -separate use
(copy_tile / copy_scanlinedeep / copy_tiledeep), covering tiled, deep
scanline and deep tiled inputs.

The only case left unsupported is splitting the views of a tiled or
deep file into multiple parts, which the scanline copy path cannot
express; that now fails early with a clear message instead of the
type-mismatch error.

Add tiled and deep cases to the exrmultipart CLI test, converting the
WavyLinesLatLong.exr and 42.deep.exr fixtures and confirming the output
preserves the input's pixel type.

Fixes #2820

Assisted-by: Copilot / Claude Opus 4.8

Signed-off-by: Cary Phillips <seabeepea@gmail.com>
@cary-ilm cary-ilm added v3.5.4 and removed v3.5 labels Nov 9, 2026
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 15, 2026
## Version 3.5.4 (November 11, 2026)

Patch release that addresses several build and security issues, and
also fixes a regression introduced in v3.3.0 that leads to excessive
memory usage during write, especially with DWA compression (Issue
[#2791](AcademySoftwareFoundation/openexr#2791)).

* Fix a configuration issue with OpenJPH 0.33.0 that caused it to
  silently and incorrectly fall back to the vendored version (PR
  [#2813](AcademySoftwareFoundation/openexr#2813))
* The vendored OpenJPH is now built in a custom namespace to avoid
  symbol collision with other versions when built statically ([2811](AcademySoftwareFoundation/openexr#2811))
  built statically,
* The vendored OpenJPH version is now 0.33.0.
* Fix `exrmultipart -convert` on tiled and deep single-part files
* `OPENEXR_USE_INTERNAL_IMATH/OPENJPH` are are now included in
  `OpenEXRConfig.h` alongside `OPENEXR_USE_INTERNAL_DEFLATE/ZSTD`.
* 32-bit glibc builds now guarantee support for files of size 2GiB or
  more ([2812](AcademySoftwareFoundation/openexr#2812))

This release addresses the following security vulnerabilities:

* ***CVE Pending*** ([GHSA-pp92-4rv3-wfq6](GHSA-pp92-4rv3-wfq6)) OpenEXR: a signed-int data-window-origin overflow in the OpenEXRUtil Image API turns `Imf::loadImage` into an attacker-steered out-of-bounds write
* ***CVE Pending*** ([GHSA-2v77-pvhx-25c3](GHSA-2v77-pvhx-25c3)) Integer overflow in legacy OpenEXR.OutputFile.writePixels() causes heap over-read

### Merged Pull Requests

* [2828](AcademySoftwareFoundation/openexr#2828)
  Add `OPENEXR_USE_INTERNAL_IMATH/OPENJPH` to BUILD.bazel (by @cary-ilm/Cary Phillips)
* [2826](AcademySoftwareFoundation/openexr#2826)
  Find Threads in installed config before OpenJPH (by @cary-ilm/Cary Phillips)
* [2824](AcademySoftwareFoundation/openexr#2824)
  Docs: make `maxSamplesPerPixel` optional for deep parts (by @cary-ilm/Cary Phillips)
* [2823](AcademySoftwareFoundation/openexr#2823)
  Fix `exrmultipart -convert` on tiled and deep single-part files (by @cary-ilm/Cary Phillips)
* [2818](AcademySoftwareFoundation/openexr#2818)
  Remove `test_write_overflow` (by @cary-ilm/Cary Phillips)
* [2817](AcademySoftwareFoundation/openexr#2817)
  Fix integer overflow in legacy Python `OutputFile.writePixels()` (by @cary-ilm/Cary Phillips)
* [2816](AcademySoftwareFoundation/openexr#2816)
  Fix integer overflow in OpenEXRUtil Image channel base pointers (by @cary-ilm/Cary Phillips)
* [2814](AcademySoftwareFoundation/openexr#2814)
  CI: validate that the build uses the dependencies the job installed (by @cary-ilm/Cary Phillips)
* [2813](AcademySoftwareFoundation/openexr#2813)
  Accept a newer OpenJPH, and warn when an installed one is too old (by @cary-ilm/Cary Phillips)
* [2812](AcademySoftwareFoundation/openexr#2812)
  Define `_FILE_OFFSET_BITS=64` for OpenEXRCore explicitly (by @cary-ilm/Cary Phillips)
* [2811](AcademySoftwareFoundation/openexr#2811)
  Rename vendored OpenJPH namespace, and hide zstd visibility (by @cary-ilm/Cary Phillips)
* [2809](AcademySoftwareFoundation/openexr#2809)
  Reduce write memory (by @kdt3rd/Kimball Thurston)
* [2808](AcademySoftwareFoundation/openexr#2808)
  Bump OpenJPH version to 0.33.0 (by @cary-ilm/Cary Phillips)
* [2802](AcademySoftwareFoundation/openexr#2802)
  Use unaligned stores in the flat unpack fast paths (by @Ar-maan05/Armaan Sandhu)
* [2798](AcademySoftwareFoundation/openexr#2798)
  Fix heap overflow in legacy Python `InputFile.channel()` with ySampling (by @Dilshad-Tanvi)
* [2796](AcademySoftwareFoundation/openexr#2796)
  exrenvmap test: shrink output size and skip blur under QEMU emulation (by @cary-ilm/Cary Phillips)
* [2794](AcademySoftwareFoundation/openexr#2794)
  Only zero the DWA chunk header instead of the full output buffer (by @vlazar-ilm/Vlad Lazar)
* [2792](AcademySoftwareFoundation/openexr#2792)
  Fix `Python File.write()` over-reads for subsampled and RGB pixel arrays (by @Dilshad-Tanvi)
* [2758](AcademySoftwareFoundation/openexr#2758)
  Fix tile chunk extents at reduced-resolution edges (by @vera-rubin/Nathan Chandrasekar)
* [2734](AcademySoftwareFoundation/openexr#2734)
  Fix B44/B44A raw fallback when compressed size equals raw size (by @vera-rubin/Nathan Chandrasekar)

### Merged Workflow Pull Requests

* [2835](AcademySoftwareFoundation/openexr#2835)
  release-notice: add workflow_dispatch to send announcements manually (by @cary-ilm/Cary Phillips)
* [2834](AcademySoftwareFoundation/openexr#2834)
  ci: add `openjph_sha` to `ci_full/ci_premerge` with: blocks (by @cary-ilm/Cary Phillips)
* [2832](AcademySoftwareFoundation/openexr#2832)
  Bump the actions-deps group across 1 directory with 2 updates (by @app/dependabot)
* [2827](AcademySoftwareFoundation/openexr#2827)
  Bump CI's default OpenJPH to 0.33.0 (by @cary-ilm/Cary Phillips)
* [2822](AcademySoftwareFoundation/openexr#2822)
  Bump the bazel-deps group with 2 updates (by @app/dependabot)
* [2799](AcademySoftwareFoundation/openexr#2799)
  Fix missing step id breaking Slack release notifications (by @cary-ilm/Cary Phillips)
* [2797](AcademySoftwareFoundation/openexr#2797)
  Bump the bazel-deps group with 3 updates (by @app/dependabot)
* [2793](AcademySoftwareFoundation/openexr#2793)
  Bump the actions-deps group across 1 directory with 2 updates (by @app/dependabot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exrmultipart -convert fails on valid tiled or deep single-part files (type-mismatch error)

2 participants