Skip to content

Clamp ProgressBar completion to the drawable range - #1388

Merged
penguinolog merged 1 commit into
urwid:masterfrom
penguinolog:fix-progressbar-security
Oct 2, 2026
Merged

penguinolog merged 1 commit into
urwid:masterfrom
penguinolog:fix-progressbar-security

Conversation

@penguinolog

Copy link
Copy Markdown
Collaborator

ProgressBar raised or drew the wrong bar when current or done was out of range or not finite:

  • done <= 0 or NaN, and a NaN ratio, now render an empty bar.
  • current is clamped to [0, done], including infinite values, so a negative current no longer draws a part-filled bar or raises IndexError when satt is set.
  • An operand too large for a float draws a full bar when current exceeds done, and an empty one otherwise.
  • get_text() and render() share the clamped computation.
Checklist
  • I've ensured that similar functionality has not already been implemented
  • I've ensured that similar functionality has not earlier been proposed and declined
  • I've branched off the master branch
  • I've merged fresh upstream into my branch recently
  • I've ran tox successfully in local environment
  • I've included docstrings and/or documentation and/or examples for my code (if this is a new feature)

ProgressBar raised or drew the wrong bar when current or done was out of
range or not finite:

- done <= 0 or NaN, and a NaN ratio, now render an empty bar.
- current is clamped to [0, done], including infinite values, so a
  negative current no longer draws a part-filled bar or raises
  IndexError when satt is set.
- An operand too large for a float draws a full bar when current
  exceeds done, and an empty one otherwise.
- get_text() and render() share the clamped computation.
@penguinolog penguinolog added the bug label Oct 2, 2026
@penguinolog
penguinolog merged commit ab85db9 into urwid:master Oct 2, 2026
22 checks passed
@penguinolog
penguinolog deleted the fix-progressbar-security branch October 2, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant