Skip to content

Update metaio - #6835

Merged
hjmjohnson merged 2 commits into
InsightSoftwareConsortium:mainfrom
blowekamp:update_metaio
Sep 4, 2026
Merged

Update metaio#6835
hjmjohnson merged 2 commits into
InsightSoftwareConsortium:mainfrom
blowekamp:update_metaio

Conversation

@blowekamp

Copy link
Copy Markdown
Member

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

MetaIO Maintainers and others added 2 commits September 4, 2026 09:03
Code extracted from:

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

at commit 1755773c8d678c5c9a57999c8ec373703134c0e2 (master).
# By MetaIO Maintainers
* upstream-MetaIO:
  MetaIO 2026-09-04 (1755773c)
@github-actions github-actions Bot added the area:ThirdParty Issues affecting the ThirdParty module label Sep 4, 2026
@blowekamp
blowekamp requested a review from hjmjohnson September 4, 2026 13:04
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Summary

The compressed-stream termination change can reject valid compressed MetaIO data when the output buffer is filled before a zlib trailer delivered in a later input chunk is consumed. This must be corrected before merging because affected MetaImage and MetaArray reads can fail.

Confidence Score: 4/5

Not safe to merge until valid compressed inputs with exact-size output buffers can be read across this input-chunk boundary.

A focused native reproduction confirmed that valid decompressed output is rejected when the zlib trailer arrives after the output buffer has been fully consumed.

Files Needing Attention: Modules/ThirdParty/MetaIO/src/MetaIO/src/metaUtils.cxx

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced proofs for two posted P1 findings and linked them to their review comments.
  • T-Rex performed general-contract-validation proof, noting that the run exited with code 0 and that the uploaded evidence test and log captured the exact zlib return values and MetaIO decisions.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Clean-termination check rejects valid exact-size output when the zlib trailer arrives in a later input chunk

    • Bug
      • At metaUtils.cxx:894-899, MET_PerformUncompression requires the final inflate status to be Z_STREAM_END. If the final data byte exactly exhausts caller output while the zlib wrapper trailer is deferred to the next source chunk, zlib returns Z_OK for the producing call and Z_BUF_ERROR on MetaIO's next inner-loop call because avail_out is zero. The decompressed payload is complete and valid, but the new check returns false.
    • Cause
      • The loop can call inflate() with a zero-length output buffer after exact output exhaustion. zlib cannot consume/validate a trailer in that call and correctly returns Z_BUF_ERROR; this is not evidence of malformed compressed data.
    • Fix
      • Do not require Z_STREAM_END after output has exactly reached uncompressedDataSize solely because no output capacity remains. Preserve malformed-stream validation by allowing this exact-full-buffer Z_BUF_ERROR state (or provide one byte of temporary output capacity to permit trailer consumption and require Z_STREAM_END).

    T-Rex Ran code and verified through T-Rex

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

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

@hjmjohnson hjmjohnson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would like to see the greptile concern responded to.

@blowekamp

Copy link
Copy Markdown
Member Author

I would like to see the greptile concern responded to.

@hjmjohnson That change was already in MetaIO upstream and unrelated to my issue I was trying to address. In fact it appears you make the change: Kitware/MetaIO#145 Are you able to fix the issue raised with your contribution?

I am also not sure if we should be using the AI code reviews on the thirdpary code when merged from upstream.

@hjmjohnson
hjmjohnson merged commit ed7a5c2 into InsightSoftwareConsortium:main Sep 4, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ThirdParty Issues affecting the ThirdParty module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants