Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIFF: check IFD entry offset before seeking #4099

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

melissalinkert
Copy link
Member

Fixes #3941 (I think). showinf -noflat -resolution 6 on each of 3 affected files referenced in #3941 works with this PR, but does not work without this PR. The forthcoming configuration PR will include NDP.view2 screenshots for reference; it's worth noting that all 3 affected files have 3 Z sections.

Assuming tests pass, should be safe for a patch release.

...when using artifical 64-bit offsets. This is identical to the check that
occurs when using the file's native offset width.

Fixes ome#3941
@melissalinkert melissalinkert requested a review from dgault October 2, 2023 13:21
@melissalinkert melissalinkert added this to the 7.0.1 milestone Oct 2, 2023
Copy link
Member

@dgault dgault left a comment

Choose a reason for hiding this comment

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

Tested using the sample files from curated/hamamatsu/imagesc-76590 and curated/hamamatsu/imagesc-86248

Without the Pr I was seeing the same exceptions as originally reported:

Exception in thread "main" java.lang.IllegalArgumentException: newLimit > capacity: (1858100467 > 5)
	at java.base/java.nio.Buffer.createLimitException(Buffer.java:388)
	at java.base/java.nio.Buffer.limit(Buffer.java:362)
	at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:1322)
	at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:266)
	at loci.common.NIOFileHandle.read(NIOFileHandle.java:309)
	at loci.common.NIOFileHandle.read(NIOFileHandle.java:298)
	at loci.common.NIOFileHandle.read(NIOFileHandle.java:286)
	at loci.common.RandomAccessInputStream.read(RandomAccessInputStream.java:681)
	at loci.formats.tiff.TiffParser.getIFDValue(TiffParser.java:566)
	at loci.formats.tiff.TiffParser.fillInIFD(TiffParser.java:526)
	at loci.formats.in.MinimalTiffReader.initFile(MinimalTiffReader.java:483)
	at loci.formats.in.BaseTiffReader.initFile(BaseTiffReader.java:609)
	at loci.formats.in.NDPIReader.initFile(NDPIReader.java:311)
	at loci.formats.FormatReader.setId(FormatReader.java:1466)

With the PR included the exception was not seen and the file was able to be opened and displayed as expected. All builds and repo tests have remained green with this PR and the config PR included.

@dgault dgault merged commit f9f4617 into ome:develop Oct 4, 2023
@melissalinkert melissalinkert deleted the gh-3941 branch September 6, 2024 19:01
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.

NDPI: IllegalArgumentException when parsing IFD values on Mac
2 participants