Skip to content

fix: allow frame sizes up to 2^32 - 1 - #841

Open
MaxonT wants to merge 1 commit into
aws:masterfrom
MaxonT:contrib/130-auto
Open

MaxonT wants to merge 1 commit into
aws:masterfrom
MaxonT:contrib/130-auto

Conversation

@MaxonT

@MaxonT MaxonT commented Nov 29, 2026 •

Copy link
Copy Markdown

Frame size in the message format is an unsigned 32-bit value, so this raises the limit from 2^31 - 1 to 2^32 - 1 as issue #130 asks; tell me if you would rather keep the old check.

Fixes #130

MAX_FRAME_SIZE is now 2**32 - 1. The frame length is already written and read as >I (an unsigned 32-bit integer), so nothing else in serialization changes. With that limit, a header can no longer carry a frame length above the maximum, so the "frame length larger than allowed maximum" check in deserialize.py could never fire and is removed along with its test and the test header that packed MAX_FRAME_SIZE + 1 (which no longer fits in 32 bits). validate_frame_length still rejects anything above the limit on the encrypt side.

Tests: test_defaults.py now expects 2**32 - 1, and a new test_validate_frame_length_above_signed_32_bit_limit checks that 2**31 and 2**32 - 128 are accepted. With the old constant that new test fails.

What I ran: pytest test/unit (4229 passed, 20 skipped) in a fresh venv on this branch. Not run: integration tests, and no test encrypts a message with a frame of more than 2 GiB, because that needs several GiB of memory.

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>
@MaxonT
MaxonT requested a review from a team as a code owner November 29, 2026 00:32
@MaxonT

MaxonT commented Dec 3, 2026

Copy link
Copy Markdown
Author

Hi @akareddy04, could you please review this when you have a moment?

In short: Allow frame sizes up to 2^32 - 1.

I think this will be really valuable. You may want to take a look. Thanks!

This branch has not been deployed

No deployments
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.

Fix max frame size

1 participant