Skip to content

Adding an upper limit for blocks_max in _set_blocks_max#3703

Merged
hugovk merged 6 commits into
python-pillow:masterfrom
jkrshnmenon:master
Jun 27, 2019
Merged

Adding an upper limit for blocks_max in _set_blocks_max#3703
hugovk merged 6 commits into
python-pillow:masterfrom
jkrshnmenon:master

Conversation

@jkrshnmenon
Copy link
Copy Markdown
Contributor

@jkrshnmenon jkrshnmenon commented Mar 8, 2019

Changes proposed in this pull request:

  • Fixing a potential integer overflow in ImagingMemorySetBlocksMax

The integer blocks_max is properly sanitized before being used in an arithmetic operation.
This PR should fix this issue by adding an upper limit to this variable.

If the error message is not appropriate, please do let me know and I will fix it accordingly.

@radarhere
Copy link
Copy Markdown
Member

You've created a separate test file for this, which means that it wouldn't be run in our standard tests. I would suggest adding your test commands below the test that blocks_max should be greater than 0.

@jkrshnmenon
Copy link
Copy Markdown
Contributor Author

jkrshnmenon commented Mar 18, 2019

Oh, my bad. I didn't know how to add the appropriate test-case.
I've added the test command like you suggested. But I'm not sure if this test-case needs to be run for 64-bit systems.
What would you suggest?

@radarhere
Copy link
Copy Markdown
Member

I've created https://github.com/jkrshnmenon/Pillow/pull/1 as a suggestion.

@hugovk hugovk merged commit 372c7c3 into python-pillow:master Jun 27, 2019
@hugovk
Copy link
Copy Markdown
Member

hugovk commented Jun 27, 2019

Thank you.

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.

3 participants