Repository navigation
rastertopclx: check the row end before reading in CompressData - #807
Merged
tillkamppeter merged 1 commit intoNov 18, 2026
Merged
tillkamppeter merged 1 commit into
tillkamppeter merged 1 commit into
Conversation
The mode 3 loop that collects non-matching bytes and both mode 10 RGB tuple scans dereferenced line_ptr and seed before testing them against line_end, so a run reaching the end of the row read up to 3 bytes past the row and seed buffers. Test the bound first.
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.
*line_ptr != *seedbeforeline_ptr < line_end, and both mode 10 RGB tuple scans readline_ptr[0..2]/seed[0..2]before(line_ptr + 2) < line_end. Whenever a run reaches the end of the row (or the row length is not a multiple of 3 in mode 10), the filter reads 1 to 3 bytes past PixelBuffer (or the dot buffer) and SeedBuffer, both exact-size heap allocations.heap-buffer-overflow ... READ of size 1 ... 0 bytes after 5-byte regionat each of the three loops.&&short-circuits, the output is unchanged for in-bounds data: a differential run of the old and new function over 300k random rows (modes 0/1/2/3/10, gray and RGB, valid and invalid seed) gave zero output mismatches.The mode 1, mode 2 and gray mode 10 loops already test the bound first, and rastertoescpx only has the PackBits path, which is fine.