Skip to content

Fix crash when freeing JPEG comments.#37

Merged
mdadams merged 2 commits intojasper-software:mainfrom
auouymous:fix-jpeg-free-crash
Aug 22, 2025
Merged

Fix crash when freeing JPEG comments.#37
mdadams merged 2 commits intojasper-software:mainfrom
auouymous:fix-jpeg-free-crash

Conversation

@auouymous
Copy link
Copy Markdown
Contributor

A pointer to the local xvcmt buffer was stored in the global comment. 9c2e7ae added if (comment) free(comment); which causes a segfault.

Can be reproduced by opening a second JPEG after cropping and saving a JPEG.

The second patch may or may not be needed, and could be removed if comment is guaranteed to always be NULL. It just makes sense to free and avoid possible leaks.

A pointer to the local `xvcmt` buffer was stored in the global
`comment`. 9c2e7ae added
`if (comment) free(comment);` which causes a segfault.

Can be reproduced by opening a second JPEG after cropping and saving a
JPEG.
It might be possible for `comment` to not be NULL, resulting in a memory
leak after changing it.
@mdadams mdadams merged commit c75ebc3 into jasper-software:main Aug 22, 2025
@auouymous auouymous deleted the fix-jpeg-free-crash branch August 29, 2025 01:46
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.

2 participants