Skip to content

Fix handling of subsampled channels in PyOpenEXR#2542

Open
cary-ilm wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
cary-ilm:fix-c32g-9w8w-3px6
Open

Fix handling of subsampled channels in PyOpenEXR#2542
cary-ilm wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
cary-ilm:fix-c32g-9w8w-3px6

Conversation

@cary-ilm

Copy link
Copy Markdown
Member

readPixels() allocated the pixel array with the full data-window shape (height, width) for all channels, but for subsampled channels the EXR reader only wrote width/xSampling values per row and height/ySampling rows total. The unwritten rows/columns retained stale heap contents that were returned to Python as valid pixel data.

Fix: shrink c_shape to the actual sampled dimensions before allocating, using ceiling division consistent with EXR's sampling convention. The framebuffer yStride calculation already used shape[1]/C.xSampling, so no stride change is needed.

Addresses https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-c32g-9w8w-3px6

readPixels() allocated the pixel array with the full data-window shape
(height, width) for all channels, but for subsampled channels the EXR
reader only wrote width/xSampling values per row and height/ySampling
rows total. The unwritten rows/columns retained stale heap contents
that were returned to Python as valid pixel data.

Fix: shrink c_shape to the actual sampled dimensions before allocating,
using ceiling division consistent with EXR's sampling convention. The
framebuffer yStride calculation already used shape[1]/C.xSampling, so
no stride change is needed.

Addresses https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-c32g-9w8w-3px6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
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.

1 participant