Skip to content

fix jdimension overflow in jpegli_crop_scanline bounds check#242

Open
rootvector2 wants to merge 1 commit into
google:mainfrom
rootvector2:crop-scanline-offset-overflow
Open

fix jdimension overflow in jpegli_crop_scanline bounds check#242
rootvector2 wants to merge 1 commit into
google:mainfrom
rootvector2:crop-scanline-offset-overflow

Conversation

@rootvector2

@rootvector2 rootvector2 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

*xoffset + *width in jpegli_crop_scanline is computed in 32-bit JDIMENSION, so a large *xoffset wraps the sum below output_width and the bounds check accepts an out-of-range crop window; master->xoffset_ is then left out of range and WriteToOutput reads the decoded component rows past their end, with the bytes landing in the caller's scanline buffer. found auditing the crop api. the check is rewritten to compare without the addition, which also covers the jpeg_crop_scanline wrapper, and a regression test is added.

Pull Request Checklist

  • CLA Signed: Have you signed the Contributor License Agreement (individual or corporate, as appropriate)? Only contributions from signed contributors can be accepted.
  • Authors: Have you considered adding your name to the AUTHORS file?
  • Code Style: Have you ensured your code adheres to the project's coding style guidelines? You can use ./ci.sh lint for automatic code formatting.

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