Fix subsampled row addressing in generic_unpack for multi-line chunks#2543
Open
cary-ilm wants to merge 1 commit into
Open
Fix subsampled row addressing in generic_unpack for multi-line chunks#2543cary-ilm wants to merge 1 commit into
cary-ilm wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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