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_truetype: division by 0 in stbtt__fill_active_edges_new() #1316

Open
ocornut opened this issue Mar 29, 2022 · 3 comments
Open

stb_truetype: division by 0 in stbtt__fill_active_edges_new() #1316

ocornut opened this issue Mar 29, 2022 · 3 comments

Comments

@ocornut
Copy link
Contributor

ocornut commented Mar 29, 2022

Describe the bug
Apparently there's a division by zero in stbtt__fill_active_edges_new() on that line:

dy = (y_final - y_crossing ) / (x2 - (x1+1)); // if denom=0, y_final = y_crossing, so y_final <= y_bottom

See: ocornut/imgui#5139

To Reproduce
I am sorry I do not have a repro yet. This was reported by @mgerhardy and I am waiting on their answer. I tried loading a few fonts with an extra assert and it didn't trigger for me.

Martin proposed fix is vengi-voxel/vengi@a337eca but I haven't looked at the code so know if it makes sense.

@nothings
Copy link
Owner

I believe the suggested fix is fine, as the 0 case should mean there will be no further use of dy anyway.

@nothings
Copy link
Owner

I've fixed this locally, but I don't know when the next release will be.

@ocornut
Copy link
Contributor Author

ocornut commented Apr 1, 2022

Thank you Sean.
(I've pushed the same fix on our own copy too now).

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

No branches or pull requests

3 participants