Skip to content

Merge MetaIO 2026-07-22 (8c41a1d9): fix #6575 B64/B65/B66 - #6692

Merged
hjmjohnson merged 3 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:update-vendored-metaio-8c41a1d
Jul 23, 2026
Merged

Merge MetaIO 2026-07-22 (8c41a1d9): fix #6575 B64/B65/B66#6692
hjmjohnson merged 3 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:update-vendored-metaio-8c41a1d

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Updates the vendored MetaIO to upstream Kitware/MetaIO 8c41a1d9 (2026-07-22), landing the fixes for #6575 items B64, B65, and B66. Standard two-parent ThirdParty vendor merge; the diff is MetaIO-only.

Upstream fixes (both merged): Kitware/MetaIO#141 (B64) and Kitware/MetaIO#142 (B65, B66).

Bugs fixed
# Bug Upstream
B64 metaImage ElementDataFile = LIST: out-of-range file dimension (LIST -1, LIST NDims) and short slice lists falsely reported success Kitware/MetaIO#141
B65 M_ReadElements: a compressed image with no CompressedDataSize measured from the start of the file, so a LOCAL image inflated its own ASCII header Kitware/MetaIO#142
B66 MET_PerformUncompression unconditionally returned true; dest_pos accounting skipped the final inflate, so no byte-count check was possible — both fixed, and both call sites now honour the result Kitware/MetaIO#142

Upstream added two regression tests, vendored here: testMeta13ImageList.cxx (B64) and testMeta14ImageCompressed.cxx (B65/B66).

Local verification
  • Two-parent merge of the 8c41a1d9 MetaIO snapshot into main; diff vs main is MetaIO-only (9 files).
  • pre-commit run --all-files clean.
  • 83/83 Meta tests pass, including testMeta13ImageList and testMeta14ImageCompressed.

MetaIO Maintainers and others added 2 commits July 23, 2026 11:56
Code extracted from:

    https://github.com/Kitware/MetaIO.git

at commit 8c41a1d91be82efab6fae3524aa929af76cf339b (master).
# Conflicts:
#	Modules/ThirdParty/MetaIO/src/MetaIO/src/tests/testMeta13ImageList.cxx
#	Modules/ThirdParty/MetaIO/src/MetaIO/src/tests/testMeta14ImageCompressed.cxx
@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:ThirdParty Issues affecting the ThirdParty module labels Jul 23, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review July 23, 2026 20:27
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Updates the vendored MetaIO snapshot with stricter LIST handling and compressed-data validation.

  • Corrects LIST dimension bounds and rejects incomplete file lists.
  • Measures omitted compressed-data sizes from the current stream position.
  • Propagates decompression failures through MetaImage and MetaArray reads.
  • Adjusts the VTK MetaIO target/export symbol configuration.
  • Adds regression tests for LIST input and compressed images.

Confidence Score: 3/5

The PR should not merge until decompression success requires a complete zlib stream rather than only the expected output byte count.

A stream that fills the destination exactly can exit through Z_BUF_ERROR without reaching Z_STREAM_END, yet MET_PerformUncompression returns true and both public read paths accept the data.

Modules/ThirdParty/MetaIO/src/MetaIO/src/metaUtils.cxx

T-Rex T-Rex Logs

What T-Rex did

  • A minimal C++ harness was created to reproduce and read the incomplete zlib stream.
  • The regression harness executable was compiled successfully and produced for verification.
  • Runtime verification showed the incomplete zlib stream was accepted by both decompression paths, producing 4096 bytes with Z_OK and no Z_STREAM_END, and MetaImage::Read exposed the expected pixel values.
  • Build and test transcripts were captured, documenting the exact build command, working directory, verbose Ninja invocation, and the passing CTest results.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
Modules/ThirdParty/MetaIO/src/MetaIO/src/metaUtils.cxx Adds output-byte accounting but still permits decompression success without reaching the end of the compressed stream.
Modules/ThirdParty/MetaIO/src/MetaIO/src/metaImage.cxx Fixes LIST bounds and completeness checks, corrects LOCAL compressed-data positioning, and propagates decompression failure.
Modules/ThirdParty/MetaIO/src/MetaIO/src/metaArray.cxx Corrects inferred compressed-data positioning and propagates decompression failure.
Modules/ThirdParty/MetaIO/src/MetaIO/src/CMakeLists.txt Aligns the VTK physical target name and shared-library export symbol with VTK's MetaIO integration.
Modules/ThirdParty/MetaIO/src/MetaIO/src/tests/testMeta13ImageList.cxx Adds regression coverage for valid, incomplete, and out-of-range LIST inputs.
Modules/ThirdParty/MetaIO/src/MetaIO/src/tests/testMeta14ImageCompressed.cxx Adds compressed LOCAL and truncation regression coverage, but does not exercise an exact-size stream missing a valid trailer.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[MetaImage or MetaArray read] --> B[Determine compressed input size]
  B --> C[MET_PerformUncompression]
  C --> D{inflate reached Z_STREAM_END?}
  D -->|Yes| E{Produced expected bytes?}
  D -->|No| F[Return failure]
  E -->|Yes| G[Read succeeds]
  E -->|No| F
Loading

Reviews (1): Last reviewed commit: "Merge branch 'upstream-MetaIO' into upda..." | Re-trigger Greptile

Comment thread Modules/ThirdParty/MetaIO/src/MetaIO/src/metaUtils.cxx
@github-actions github-actions Bot added the area:IO Issues affecting the IO module label Jul 23, 2026
@hjmjohnson

Copy link
Copy Markdown
Member Author

Fixed the ARMBUILD-arm / ITK.Linux failure (itkImageFileReaderManyComponentVectorTest). Root cause: the many-component fixture's compressed stream was truncated — it decompresses to 119 bytes while the header declares 31 MET_FLOAT channels (124 bytes). The old MetaIO silently accepted the short read; the 8c41a1d9 uncompression-result fix in this PR correctly rejects it.

Repointed the content link to a valid re-encoded blob (InsightSoftwareConsortium/ITKTestingData#78, merged) in commit 571c7d9. Verified locally against the mirror-fetched blob: reads exit 0 under this PR's MetaIO build; pre-commit run --all-files clean.

The prior fixture's compressed stream was truncated (decompressed to 119
bytes while its header declares 31 MET_FLOAT channels = 124 bytes). The
MetaIO 8c41a1d9 uncompression-result fix in this branch correctly rejects
it, breaking itkImageFileReaderManyComponentVectorTest.

Point the content link at the valid re-encoded blob published in
InsightSoftwareConsortium/ITKTestingData#78.
@hjmjohnson
hjmjohnson force-pushed the update-vendored-metaio-8c41a1d branch from 571c7d9 to 1491f01 Compare July 23, 2026 22:06
@hjmjohnson

Copy link
Copy Markdown
Member Author

Upstream fix for the greptile response at Kitware/MetaIO#145. Will need to rebase once that is in place. Merging this as is for now. The upstream is real, but out of scope for clearing the problems identified in 6675.

@hjmjohnson
hjmjohnson merged commit 0025f9c into InsightSoftwareConsortium:main Jul 23, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:IO Issues affecting the IO module area:ThirdParty Issues affecting the ThirdParty module type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants