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

Don't attempt to extract a URL from invalid coordinates (-1,-1) #434

Merged
merged 1 commit into from
Jan 18, 2021
Merged

Don't attempt to extract a URL from invalid coordinates (-1,-1) #434

merged 1 commit into from
Jan 18, 2021

Conversation

anthroid
Copy link
Contributor

When the terminal context menu is opened from a session titlebar, the coordinates passed to menuAtCoord:(VT100GridCoord)coord are (-1,-1), of which the y-coordinate is used as an array index to extract a line from the terminal grid in order to extract a URL. This causes a crash due to a [-1] array index downstream in getLineAtIndex:(int)theIndex as the context menu is being built when left-clicking the session titlebar context menu button in all versions after 2534252 with the following message:

Performing @selector(openMenu:) from sender NSButton 0x600001e6c4d0
Assertion failed: (NO), function -[VT100Screen getLineAtIndex:withBuffer:],
file /Users/.../iTerm2/sources/VT100Screen.m, line 1804.

This PR adds a lower bounds check on the coordinates before attempting to retrieve the line and extract the URL.

…ntext menu is opened from the session titlebar
@gnachman gnachman merged commit 4d4e2a6 into gnachman:master Jan 18, 2021
@gnachman
Copy link
Owner

Thank you!

gnachman pushed a commit that referenced this pull request Feb 8, 2021
…ntext menu is opened from the session titlebar (#434)
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