Skip to content

fix: update IOtiff.cpp to use public libtiff APIs and standard types#1176

Open
mcoliver wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
mcoliver:iotiff-private-to-public
Open

fix: update IOtiff.cpp to use public libtiff APIs and standard types#1176
mcoliver wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
mcoliver:iotiff-private-to-public

Conversation

@mcoliver
Copy link
Contributor

@mcoliver mcoliver commented Mar 3, 2026

  • Replace internal <tiffiop.h> with public <tiffio.h>
  • Use standard types (uint32_t, uint16_t)
  • Use standard malloc/free instead of libtiff internals
  • Update tag enumeration and field access to use supported public APIs

Building with private methods should be reserved for very specific cases where a public function is not available. From what I can tell we should be able to use standard malloc and free. This is a) best practice, and b) will allow RV to be built with precompiled binaries of libtiff (for example installed with homebrew where the private headers are not included in the distribution)

This also remedies crashes I was experiencing when pulling in malformed tiffs with unsupported bit depths (eg 10,12,14).

mcoliver added 3 commits March 3, 2026 09:30
- Replace internal <tiffiop.h> with public <tiffio.h>
- Use standard <cstdint> types (uint32_t, uint16_t)
- Use standard malloc/free instead of libtiff internals
- Update tag enumeration and field access to use supported public APIs

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
Signed-off-by: Michael Oliver <mcoliver@gmail.com>
Signed-off-by: Michael Oliver <mcoliver@gmail.com>
@mcoliver mcoliver changed the title refactor: update IOtiff.cpp to use public libtiff APIs and standard types fix: update IOtiff.cpp to use public libtiff APIs and standard types Mar 4, 2026
@mcoliver
Copy link
Contributor Author

mcoliver commented Mar 4, 2026

I had this as a refactor but considering that the PR also makes the program less prone to crashing when receiving malformed or unsupported tiffs I switched to fix

@mcoliver mcoliver marked this pull request as ready for review March 4, 2026 16:24
@mcoliver
Copy link
Contributor Author

example tif that will segfault the current main but loads fine with the fix in this PR
color_test_final.tif

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.

1 participant