Skip to content

Conversation

@radarhere
Copy link
Member

Resolves #6507

The issue found an image that hits

Pillow/src/map.c

Lines 116 to 117 in 6b35dc2

if (offset + size > view.len) {
PyErr_SetString(PyExc_ValueError, "buffer is not large enough");

However, that is when it uses mmap, and the image loads correctly without mmap. The explanation would be that the image is truncated, but not critically so.

This PR copies the "buffer is not large enough" into Python, and switches back to normal image loading if the condition fails.

The test image was created by copying one of our existing test images and truncating.

@hugovk hugovk merged commit b607e83 into python-pillow:main Aug 31, 2022
@radarhere radarhere deleted the buffer branch August 31, 2022 10:51
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.

ValueError: buffer is not large enough

2 participants