Skip to content

Fix subsampled row addressing in generic_unpack for multi-line chunks#2543

Open
cary-ilm wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
cary-ilm:GHSA-7828-c4f6-7v6p
Open

Fix subsampled row addressing in generic_unpack for multi-line chunks#2543
cary-ilm wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
cary-ilm:GHSA-7828-c4f6-7v6p

Conversation

@cary-ilm

Copy link
Copy Markdown
Member

generic_unpack() tests row membership with the absolute file row (cury = y + chunk.start_y) but computed the compact FrameBuffer destination using the chunk-local row (y - user_line_begin_skip). For multi-line compressed chunks such as ZIP's 16-line blocks, later chunks often begin at a file row that is not a multiple of ySampling. The first sampled row in such a chunk then has a non-zero chunk-local index, and (y - uls) / y_samples truncates to the wrong compact row. Decoded rows land in the wrong buffer rows and the last sampled row may remain stale.

Compute the destination offset relative to decode_to_ptr, which callers already position at the compact row for the current read origin (fb_y = user_line_begin_skip + chunk.start_y):

(cury / y_samples - fb_y / y_samples) * user_line_stride

Addresses https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-7828-c4f6-7v6p

generic_unpack() tests row membership with the absolute file row
(cury = y + chunk.start_y) but computed the compact FrameBuffer
destination using the chunk-local row (y - user_line_begin_skip).
For multi-line compressed chunks such as ZIP's 16-line blocks, later
chunks often begin at a file row that is not a multiple of ySampling.
The first sampled row in such a chunk then has a non-zero chunk-local
index, and (y - uls) / y_samples truncates to the wrong compact row.
Decoded rows land in the wrong buffer rows and the last sampled row
may remain stale.

Compute the destination offset relative to decode_to_ptr, which callers
already position at the compact row for the current read origin
(fb_y = user_line_begin_skip + chunk.start_y):

  (cury / y_samples - fb_y / y_samples) * user_line_stride

Addresses https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-7828-c4f6-7v6p

Signed-off-by: Cary Phillips <cary@ilm.com>
Co-authored-by: Cursor <cursoragent@cursor.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