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 integer overflow in ImFontGlyphRangesBuilder::AddRanges #4802

Closed
wants to merge 1 commit into from

Conversation

SlavicPotato
Copy link
Contributor

Results in an infinite loop if the user passes upper range = UINT16_MAX or UINT32_MAX with ImWchar32.

Assumes IM_UNICODE_CODEPOINT_MAX < UINT32_MAX.

… in an infinite loop if the user passes upper range = UINT16_MAX or UINT32_MAX with ImWchar32.

Assumes IM_UNICODE_CODEPOINT_MAX < UINT32_MAX.
ocornut pushed a commit that referenced this pull request Dec 13, 2021
…passes upper range = UINT16_MAX without IMGUI_USE_WCHAR32. (#4802)
@ocornut
Copy link
Owner

ocornut commented Dec 13, 2021

Thank you @SlavicPotato for the PR.
I am merging this, however: Passing a "full range" to ImFontGlyphRangesBuilder goes contrary to its purpose. If you need to cover everything you do not need ImFontGlyphRangesBuilder. So its a bit of a weird edge case.

@ocornut ocornut closed this Dec 13, 2021
@SlavicPotato
Copy link
Contributor Author

Hi @ocornut, thanks! I noticed the issue after passing the 'specials' range (FFF0-FFFF). I let users define additional glyph ranges in font config files and someone might have tripped it. I wanted to avoid adding an exception for FFFF even though it's technically a non-char.

@ocornut
Copy link
Owner

ocornut commented Dec 13, 2021

Great point, thank you!

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.

2 participants