Skip to content

Ensure map stride is at least one full row of pixels#9719

Open
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:stride
Open

Ensure map stride is at least one full row of pixels#9719
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:stride

Conversation

@radarhere

Copy link
Copy Markdown
Member

No description provided.

PyImaging_MapBuffer only recomputed the row stride when it was <= 0;
a positive stride smaller than a full row of pixels was used as-is.
Memory mapping then laid out the row pointers that close together while
consumers read a full row (xsize * pixelsize) from each, reading past
the mapped buffer -- an out-of-bounds read leading to process-memory
disclosure or a SIGBUS crash. This is reachable from Image.open() on a
crafted McIdas AREA file (the header supplies the stride) opened from a
path, which engages the mmap fast-path.

Ensure the stride is at least one full row of pixels.
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.

2 participants