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

stb_image: Fix gif two_back memory address #1404

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

Conversation

cocoa-xu
Copy link

@cocoa-xu cocoa-xu commented Nov 6, 2022

Hi, this should be a simple fix: since out is always the starting address of all layers, therefore the starting address of two layers before, two_back, should be calculated as follows,

if (layers >= 2) {
    two_back = out + ((layers - 2) * stride);
}

otherwise, it would cause a segmentation fault.

Testing image test_alpha.gif.zip

@geneotech
Copy link

Thank you so much, this actually fixes a crash I had on a large GIF file. This PR should be accepted ASAP.

@cocoa-xu
Copy link
Author

cocoa-xu commented Oct 5, 2024

Hi @nothings, sorry for the ping here. I noticed that there seems to be more people experiencing this issue, #1504 and #1688, and I believe this PR should have properly addressed the root cause. I'll be happy to write a unit test for it if there's a need for it!

@641i130
Copy link

641i130 commented Oct 14, 2024

This resolved certain gifs causing seg faults on an application I work on for work. Thank you for your work @cocoa-xu !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants