Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic when prediction calculation is invalid #282

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

richard-viney
Copy link

@richard-viney richard-viney commented Mar 5, 2025

This bug was found during fuzz testing of a library that depends on jpeg-decoder, on the following line:

let prediction = 1 << (frame.precision - scan.point_transform - 1) as i32;

It's triggered when the math underflows in the situation that scan.point_transform isn't less than frame.precision.

This PR adds a check in the parser that errors when this situation is detected, as well as the test case generated by the fuzz tester.

(I also changed to explicitly specify Ubuntu 22.04 in CI due to failures running on 24.04).

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