Skip to content

BUG: apply ITK PR #6150 - use check_symbol_exists for TIFFFieldReadCount detection#116

Merged
blowekamp merged 1 commit into
conda-forge:mainfrom
blowekamp:fix/tiff-check-symbol-exists
Apr 27, 2026
Merged

BUG: apply ITK PR #6150 - use check_symbol_exists for TIFFFieldReadCount detection#116
blowekamp merged 1 commit into
conda-forge:mainfrom
blowekamp:fix/tiff-check-symbol-exists

Conversation

@blowekamp
Copy link
Copy Markdown
Contributor

Summary

Applies the fix from upstream ITK PR InsightSoftwareConsortium/ITK#6150 as a recipe patch.

Bug

When building with ITK_USE_SYSTEM_TIFF=ON (always the case in this feedstock), the CMake detection of TIFFFieldReadCount used check_type_size(), which internally calls sizeof() on the argument. Passing a function name to sizeof() is non-standard — GCC and Clang accept it as an extension, but MSVC rejects it — so ITK_TIFF_HAS_TIFFFieldReadCount was never defined on Windows builds.

Without that define, itkTIFFImageIO falls through to a libtiff 4.0.0–4.0.2 workaround that directly accesses the internal _TIFFField struct. That struct layout is no longer correct for modern libtiff versions, causing reads of garbage data and NULL pointer crashes when encountering tags with unsupported data types (e.g. an ICC profile tag).

Fixes: InsightSoftwareConsortium/ITK#6148

Fix

Replace check_type_size(TIFFFieldReadCount ...) with check_symbol_exists(TIFFFieldReadCount "tiffio.h" ...) in Modules/ThirdParty/TIFF/CMakeLists.txt, which correctly detects the function symbol on all compilers.

Changes

  • recipe/0001-BUG-use-check_symbol_exists-for-TIFFFieldReadCount.patch — new patch applying the upstream fix
  • recipe/meta.yaml — add patches: list, bump build number 2 → 3

@blowekamp blowekamp requested a review from bluescarni as a code owner April 27, 2026 16:07
@conda-forge-admin
Copy link
Copy Markdown
Contributor

conda-forge-admin commented Apr 27, 2026

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe/meta.yaml) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe/meta.yaml:

  • ℹ️ The recipe is not parsable by parser conda-souschef (grayskull). This parser is not currently used by conda-forge, but may be in the future. We are collecting information to see which recipes are compatible with grayskull.
  • ℹ️ The recipe is not parsable by parser conda-recipe-manager. The recipe can only be automatically migrated to the new v1 format if it is parseable by conda-recipe-manager.
  • ℹ️ top-level output has some malformed specs:
  • In section build: cmake >=3.16.3, <3.30.0
    Requirement spec fields should match the syntax name [version [build]]to avoid known issues in conda-build. For example, instead of name =version=build, use name version.* build. There should be no spaces between version operators and versions either: python >= 3.8 should be python >=3.8.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/25007234114. Examine the logs at this URL for more detail.

When building with ITK_USE_SYSTEM_TIFF=ON, check_type_size() was used
to detect TIFFFieldReadCount (a function, not a type). Passing a function
to sizeof() is non-standard and silently fails on MSVC, leaving
ITK_TIFF_HAS_TIFFFieldReadCount undefined and causing itkTIFFImageIO to
fall through to a stale libtiff 4.0.0-4.0.2 workaround that accesses an
obsolete internal _TIFFField struct, causing NULL pointer crashes.

Fixes: InsightSoftwareConsortium/ITK#6148
Upstream PR: InsightSoftwareConsortium/ITK#6150
@blowekamp blowekamp force-pushed the fix/tiff-check-symbol-exists branch from ccec3e9 to 5b616ad Compare April 27, 2026 16:32
@blowekamp blowekamp merged commit afc47bb into conda-forge:main Apr 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System TIFF misconfiguration leads to crash when reading some TIFF files

2 participants