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 potential cause of segfaults in smallfry #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bekh6ex
Copy link

@bekh6ex bekh6ex commented Jun 28, 2023

I occasionally run into segfaults when using jpeg-recompress -m smallfry on some images.

Explanation of the fix

This fix is required because in line 81 there is DVAL(j + 2) which is transformed into abs(old[j+2] - new[j+2]).
On the last iteration in this loop j will be equal width - 2, meaning we are accessing abs(old[width] - new[width]),
which in case of the last row of an image is beyond what was allocated.

Probable cause of segfaults when using smallfry
@bekh6ex bekh6ex changed the title Adjuct iteration boundary Fix potential cause of segfaults in smallfry Jun 28, 2023
@bekh6ex
Copy link
Author

bekh6ex commented Jun 28, 2023

See libsmallfry for reference implementation

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