Skip to content

fix(review): a hostile diff line can't crash or freeze go to definition (DoS) - #182

Merged
backnotprop merged 1 commit into
plannotator:mainfrom
sebastianst:seb/codenav-depth
Nov 22, 2026
Merged

backnotprop merged 1 commit into
plannotator:mainfrom
sebastianst:seb/codenav-depth

Conversation

@sebastianst

Copy link
Copy Markdown
Contributor

Denial-of-service fix: go to definition (d) on a hostile line of a PR's diff could crash or freeze the TUI.

  • Stack overflow: the identifier lexer recursed once per nested JavaScript template literal, with no limit. A line of ~100k nested `${ (300 KB) overflowed the stack and aborted. Past 32 nested templates the rest of the line is now text.
  • Freeze: the word list was deduplicated with a linear scan per identifier, quadratic on the UI thread. A long line of distinct names took seconds. It now keeps a set beside the list.

🤖 Co-created with Claude Opus 5.5

Template literals nested past 32 deep are read as text instead of recursed into, and the line's words are deduplicated with a set rather than a scan per word.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@backnotprop
backnotprop added this pull request to the merge queue Nov 22, 2026
Merged via the queue into plannotator:main with commit 254c728 Nov 22, 2026
3 checks passed
@sebastianst
sebastianst deleted the seb/codenav-depth branch November 23, 2026 14:52
@backnotprop backnotprop mentioned this pull request Nov 23, 2026
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