Skip to content

Fix unsigned integer underflow in help formatting#142

Merged
Taywee merged 1 commit intoTaywee:masterfrom
metsw24-max:help-width-underflow-hardening
Apr 27, 2026
Merged

Fix unsigned integer underflow in help formatting#142
Taywee merged 1 commit intoTaywee:masterfrom
metsw24-max:help-width-underflow-hardening

Conversation

@metsw24-max
Copy link
Copy Markdown
Contributor

This patch fixes multiple unsigned integer underflow issues in the help generation logic.

Fix

All affected arithmetic operations are now guarded:

  • Subtractions are clamped to 0 when underflow would occur
  • Multi-term expressions are validated before subtraction
  • Fix applied consistently across all Wrap call sites

@Taywee
Copy link
Copy Markdown
Owner

Taywee commented Apr 27, 2026

Looks good to me. I'll move the test_underflow file into ./test after merge. Thanks for the PR.

edit: Actually, that's just used for buck. I'll leave it where it is.

@Taywee Taywee merged commit 2b1b4f7 into Taywee:master Apr 27, 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