Skip to content

Handle default value for RowsPerStrip TIFF tag#5358

Closed
radarhere wants to merge 1 commit intopython-pillow:masterfrom
radarhere:default_rowsperstrip
Closed

Handle default value for RowsPerStrip TIFF tag#5358
radarhere wants to merge 1 commit intopython-pillow:masterfrom
radarhere:default_rowsperstrip

Conversation

@radarhere
Copy link
Copy Markdown
Member

@radarhere radarhere commented Mar 24, 2021

Resolves #5319

For the RowsPerStrip TIFF tag, https://www.awaresystems.be/imaging/tiff/tifftags/rowsperstrip.html

The default is 2**32 - 1, which is effectively infinity. That is, the entire image is one strip.

However, if RowsPerStrip is too large, we reject this as an error.

/* overflow check for realloc */
if (INT_MAX / row_byte_size < rows_per_strip) {
state->errcode = IMAGING_CODEC_MEMORY;
return -1;
}

So this PR makes an allowance for that specific value.

The test image comes from the issue.

@radarhere radarhere added the TIFF label Mar 24, 2021
@radarhere radarhere force-pushed the default_rowsperstrip branch from 0409b73 to b541aff Compare March 25, 2021 06:04
Copy link
Copy Markdown
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

This has a conflict.

@radarhere
Copy link
Copy Markdown
Member Author

That's not really a conflict - it's the same change! This has been replaced by #5364

@radarhere radarhere closed this Mar 28, 2021
@radarhere radarhere deleted the default_rowsperstrip branch March 28, 2021 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"OSError: -9" saving a multi-layer TIFF via libtiff

2 participants