Skip to content

fix: validate proposed flow-control window before mutating - #1355

Open
feiiiiii5 wants to merge 1 commit into
python-hyper:masterfrom
feiiiiii5:feiiiiii5/1127-D313
Open

feiiiiii5 wants to merge 1 commit into
python-hyper:masterfrom
feiiiiii5:feiiiiii5/1127-D313

Conversation

@feiiiiii5

Copy link
Copy Markdown

What

WindowManager.window_opened() increased current_window_size before checking the upper bound. A local increment_flow_control_window() call whose increment is individually legal (1..2**31-1) but whose sum exceeds 2**31-1 therefore raised FlowControlError after the window was already corrupted: no WINDOW_UPDATE was emitted, local credit diverged from the peer, max_window_size went stale, and every later increment failed forever. Both connection and stream windows were affected.

Two earlier attempts (#1335, #1350) were withdrawn by their authors; the defect remains live on master and unowned.

How

Compute proposed = current + size, validate it against LARGEST_FLOW_CONTROL_WINDOW first, then assign. Same exception type, message, and limit; no other behavior change.

Verification

  • Two public-API regressions (connection and stream windows): base-red 2 failed / 2 passed (2147483648 == 65535), with fix 50/50 passed in the module.
  • Full suite: 1688 passed; coverage 100% overall and 100% for src/h2/windows.py (34 statements, 8 branches, no misses/partials).
  • ruff check src/h2/windows.py clean. The test module has 8 pre-existing lint findings in untouched lines; new lines are clean.

Not run: Python version matrix, h2spec, mypy, Linux CI.

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.

1 participant