fix(core): prevent TUI buffer overflow panics in dependency view scrollbar rendering#32292
Merged
FrozenPandaz merged 1 commit intomasterfrom Aug 11, 2025
Merged
fix(core): prevent TUI buffer overflow panics in dependency view scrollbar rendering#32292FrozenPandaz merged 1 commit intomasterfrom
FrozenPandaz merged 1 commit intomasterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
|
View your CI Pipeline Execution ↗ for commit 49465f0
☁️ Nx Cloud last updated this comment at |
9a6f1e0 to
6057108
Compare
6057108 to
49465f0
Compare
Contributor
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspaceOr just copy this version and use it in your own command: 0.0.0-pr-32292-49465f0
To request a new release for this pull request, mention someone from the Nx team or the |
AgentEnder
approved these changes
Aug 11, 2025
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
The TUI dependency view experiences buffer overflow panics when rendering scrollbars on small or constrained terminal sizes. Users encounter crashes with messages like "index outside of buffer" at various coordinates such as (134, 37), (86, 0), (107, 0), etc.
Expected Behavior
The TUI should handle all terminal sizes gracefully without crashing, maintaining proper visual rendering of scrollbars and padding elements while staying within buffer boundaries.
Key Code Changes
The fix adds clean, reusable helper functions for bounds checking to prevent buffer overflows:
1. New Helper Functions (lines 216-239):
2. Simplified Scrollbar Bounds Check (lines 478-481):
3. Cleaner Padding Validation (lines 241-286):
Key improvements:
fits_in_buffer()andclamp_to_buffer()can be used throughout the codebaseRelated Issue(s)
This fixes buffer overflow panics that occur when the terminal user interface attempts to render scrollbar widgets and padding outside the available buffer boundaries, particularly on smaller terminal sizes or when the terminal is resized.
The fix adds minimal bounds checking to:
Comprehensive test coverage added: 10 unit tests covering all edge cases including the specific problematic buffer dimensions that previously caused panics (45×30, 76×30, 104×30, 135×37, etc.).
Tested across multiple terminal buffer sizes and confirmed no more buffer overflow panics while maintaining correct scrollbar functionality.