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

Clear PPM half token after use #7052

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Mar 31, 2023

Resolves #6963

When PpmImagePlugin is reading an image, it only reads ImageFile.SAFEBLOCK bytes at a time.

So when looping through this data, if there is no space after the last digit, it saves this for the next loop, in case the read operation stopped partway through a series of digits.

Except that half_token isn't cleared after it is used. That means that it keeps getting used, and so infinite data is available to fill the image size.

This PR fixes that.

@radarhere radarhere merged commit 3cd1e12 into python-pillow:main Mar 31, 2023
@radarhere radarhere deleted the ppm_half_token branch March 31, 2023 23:08
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.

PPM "Channel value too large" error
1 participant