Skip to content

Fix potential cause of segfaults in smallfry - #131

Open
bekh6ex wants to merge 1 commit into
danielgtaylor:masterfrom
bekh6ex:smallfry-segfault
Open

Fix potential cause of segfaults in smallfry#131
bekh6ex wants to merge 1 commit into
danielgtaylor:masterfrom
bekh6ex:smallfry-segfault

Conversation

@bekh6ex

@bekh6ex bekh6ex commented Jun 28, 2023

Copy link
Copy Markdown

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

bekh6ex commented Jun 28, 2023

Copy link
Copy Markdown
Author

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