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

Pass the correct types to PyArg_ParseTuple #3880

Merged
merged 1 commit into from Jun 28, 2019

Conversation

QuLogic
Copy link
Contributor

@QuLogic QuLogic commented May 31, 2019

Py_ssize_t uses the 'n' specifier, not 'i'. If Py_ssize_t is bigger than int, this can be fine on little-endian systems but is very broken on big-endian systems as values end up 2**32 times bigger.

The previous change was a bit inconsistent and only changed src/encode.c, but not src/decode.c, so I'm not sure if I should have gone the other way and reverted the int->Py_ssize_t change instead.

Fixes #3841.
Fixes #3840.

Py_ssize_t uses the 'n' specifier, not 'i'.
@QuLogic
Copy link
Contributor Author

QuLogic commented May 31, 2019

I'm not sure what this segfault in CI is about, but it seems to be affecting other PRs, so I'm not sure if it's related or not.

@QuLogic
Copy link
Contributor Author

QuLogic commented Jun 1, 2019

Oh, I just realized that #3840 is ppc64, not ppc64le, i.e., big-endian. So this should fix it too.

@radarhere radarhere changed the title Pass the correct types to PyArg_ParseTuple. Pass the correct types to PyArg_ParseTuple Jun 1, 2019
@radarhere
Copy link
Member

To create a link, comments were originally made about this in #3749

@QuLogic
Copy link
Contributor Author

QuLogic commented Jun 4, 2019

So we've now built several packages (that previously failed) using this patch, so I'm pretty sure this works. It's just a matter of which way you'd like to go with the change.

Copy link
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.

Let's merge this for the next release if no objections.

@hugovk hugovk merged commit a96482b into python-pillow:master Jun 28, 2019
@hugovk
Copy link
Member

hugovk commented Jun 28, 2019

Thanks.

@QuLogic QuLogic deleted the fix-arg-parsing branch June 28, 2019 20:46
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.

"SystemError: tile cannot extend outside image" on s390x MemoryError on ppc64
3 participants