Skip to content

Comments

Fix array bounds underflow#1711

Open
Rainyan wants to merge 2 commits intoNeotokyoRebuild:masterfrom
Rainyan:bug/neoui-overflow
Open

Fix array bounds underflow#1711
Rainyan wants to merge 2 commits intoNeotokyoRebuild:masterfrom
Rainyan:bug/neoui-overflow

Conversation

@Rainyan
Copy link
Collaborator

@Rainyan Rainyan commented Feb 21, 2026

Description

Fix a case of potential array bounds underflow by NeoUI::TextEditChIdxFromMouse for empty inputs.

Steps to reproduce

  • checkout current master 04569ec
  • Build & launch the game
  • Click "Create Server"
  • Empty the "Password" field's value
  • Press escape to return to main menu
  • Click "Create Server" again
  • Now the Password field's value should be empty
  • Add a breakpoint to line:
    if (iMouseOnXWidth >= c->irTextWidths[iWszTextSize - 1])
  • Click the empty "Password" field with your mouse
  • The breakpoint should be hit

What happens

What should happen

  • irTextWidths access stays in bounds

Toolchain

  • Windows MSVC VS2022

Linked Issues

Unlikely to ever overflow but this silences a VS nag
Text size of 0 would result in array index of 0-1
@Rainyan Rainyan added the UI/HUD Relates to the HUD, NeoUI, menus, etc label Feb 21, 2026
@Rainyan Rainyan requested a review from a team February 21, 2026 02:50
@nullsystem nullsystem requested a review from a team February 21, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI/HUD Relates to the HUD, NeoUI, menus, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants