Skip to content

Conversation

brianberns
Copy link
Contributor

@brianberns brianberns commented Sep 17, 2025

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

This is a proposed fix for #2983. The idea is to truncate a too-long string, rather than throw an exception. This allows ImageSharp to successfully load some problematic TIFF files.

@CLAassistant
Copy link

CLAassistant commented Sep 17, 2025

CLA assistant check
All committers have signed the CLA.

@brianpopow
Copy link
Collaborator

brianpopow commented Sep 28, 2025

@brianberns Thanks for the contribution. Could you add one unit test for this case?

A test case would look like this:

[Theory]
[WithFile(Issue2983, PixelTypes.Rgba32)]
public void TiffDecoder_CanDecode_Issue2983<TPixel>(TestImageProvider<TPixel> provider)
    where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);

This should go into Formats/Tiff/TiffDecoderTests.cs

Then you need to add the example image with the issue into tests\Images\Input\Tiff\Issues\Issue2983.tiff

The final thing you need to do is add the image to the Tiff section in TestImages.cs, for example in line 1167:

public const string Issue2983 = "Tiff/Issues/Issue2983.tiff";

@brianberns
Copy link
Contributor Author

Done. I added the unit test and confirmed that it passes. However, I'm not very experienced with pull requests, so let me know if there are any problems.

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

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

These changes make sense to me. Thanks for your contribution. Much appreciated!

@JimBobSquarePants JimBobSquarePants merged commit 73c4a1a into SixLabors:main Sep 29, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants