Skip to content

BUG: Fix TIFFImageIO failures with ITK_USE_SYSTEM_TIFF=ON - #7240

Merged
dzenanz merged 1 commit into
InsightSoftwareConsortium:mainfrom
domibel:tiff-system-libtiff4
Nov 26, 2026
Merged

dzenanz merged 1 commit into
InsightSoftwareConsortium:mainfrom
domibel:tiff-system-libtiff4

Conversation

@domibel

@domibel domibel commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

With system libtiff, 4 tests like itkLargeTIFFImageWriteReadTest2 failed because TIFFImageIO detected libtiff 4 via TIFF_INT64_T, which current libtiff (4.7.2) no longer defines, and failed using the libtiff 3 fallback.

libtiff >= 4.0.3 is required since 40f5c4d (2024), so the fallback is not needed anymore.

With system libtiff, 4 tests like itkLargeTIFFImageWriteReadTest2 failed
because TIFFImageIO detected libtiff 4 via TIFF_INT64_T, which current
libtiff (4.7.2) no longer defines, and failed using the libtiff 3
fallback. libtiff >= 4.0.3 is required since 40f5c4d (2024), so the
fallback is not needed anymore.
@github-actions github-actions Bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances area:IO Issues affecting the IO module labels Nov 26, 2026
@greptile-apps

greptile-apps Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

security Security Review

This PR appears safe to merge from a security standpoint.

What was checked
  • Read the full diff; it only removes libtiff 3 fallback branches, leaving the libtiff 4 paths that already ran in all supported builds.
  • Confirmed the removed 'size exceeds limit' exception was dead code because libtiff >= 4.0.3 has been required since commit 40f5c4d.
  • Verified the TIFF reader still rejects a zero scanline size and handles TIFF_LONG8/TIFF_IFD8 tags exactly as before, so untrusted-file handling is unchanged.
  • Confirmed a system libtiff older than 4 would now fail at compile time rather than silently using a weaker path.

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Removes outdated TIFF_INT64_T checks from TIFFImageIO.

  • TIFFImageIO uses libtiff 4 APIs for large files, scanlines, and 64-bit tags.

Reviews (1) · Last reviewed commit: "BUG: Fix TIFFImageIO failures with ITK_U..." · Reviewed by Greptile

@blowekamp
blowekamp self-requested a review November 26, 2026 14:24

@blowekamp blowekamp 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.

These changes look good.

The CMake code used for find libtiff on the system should also enforce the version requirements so useful error messages are produced during configuration time. If this is not added as part of this PR, please create a GH issue.
https://github.com/InsightSoftwareConsortium/ITK/blob/main/Modules/ThirdParty/TIFF/CMakeLists.txt#L5

@dzenanz
dzenanz merged commit bf7210e into InsightSoftwareConsortium:main Nov 26, 2026
21 checks passed
@domibel
domibel deleted the tiff-system-libtiff4 branch November 27, 2026 20:22
@blowekamp

Copy link
Copy Markdown
Member

Was the issue or a PR created as I requested?

@hjmjohnson

Copy link
Copy Markdown
Member

@blowekamp not before this merged; it is now #7270: the three find_package(TIFF ...) calls in Modules/ThirdParty/TIFF/CMakeLists.txt require 4.0.3, so an older system libtiff stops configuration with FindTIFF's "Found unsuitable version" message.

hjmjohnson added a commit that referenced this pull request Nov 30, 2026
TIFFImageIO has needed libtiff 4.0.3 or later since 40f5c4d, and
after #7240 it has no fallback for older versions, but find_package(TIFF)
asked for no version. An older system libtiff was accepted at configure
time and failed only when TIFFImageIO compiled.

The build and both exported find_package(TIFF) calls now ask for 4.0.3,
so an older libtiff stops configuration with FindTIFF's "Found
unsuitable version" message, and so do projects that use the installed
ITK.

Requested by blowekamp in review of #7240.
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 type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants