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 potential CoreText font rendering infinite recursion #985

Merged
merged 1 commit into from Nov 4, 2019

Conversation

ychin
Copy link
Member

@ychin ychin commented Nov 4, 2019

The function recurseDraw is actually a misnomer. It uses recursion in a way that is unnecessary as it's a simple while loop that keeps drawing as many characters as possible until all are drawn. The recursion is just a convenience to invoke the CoreText rendering code. If the API for CTFontGetGlyphsForCharacters works as expected, in theory we shouldn't get infinite recursion since lookupFont calls the same function, but just for safety and to avoid potential subtle interactions with the API, just kill the recursion and directly draw the texts in the loop to make it easier to reason through.

Fix #983.

The function `recurseDraw` is actually a misnomer. It uses recursion in
a way that is unnecessary as it's a simple while loop that keeps drawing
as many characters as possible until all are drawn. The recursion is
just a convenience to invoke the CoreText rendering code. If the API for
`CTFontGetGlyphsForCharacters` works as expected, in theory we shouldn't
get infinite recursion since `lookupFont` calls the same function, but
just for safety and to avoid potential subtle interactions, just kill
the recursion and directly draw the texts in the loop to make it easier
to reason through.

Fix macvim-dev#983.
@ychin ychin merged commit 9823bad into macvim-dev:master Nov 4, 2019
@ychin ychin deleted the fix-recurse-draw branch November 4, 2019 11:13
ychin added a commit that referenced this pull request Mar 3, 2020
Vim patch 8.2.319

General:

- MacVim is now upgraded to Vim 8.2!

Fixes:

- Fix mvim:// protocol handler to handle spaces in file names. #1002
- Allow the fullscreen toggle on the Touch Bar to be disabled. #997
- Fixed potential infinite recursion draw crash. #985

Targets macOS 10.9+

Script interfaces have compatibility with these versions:

- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.7
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.

MacVim Crashes Maverick OXS 10.9
1 participant