Skip to content

fix: clamp Extend size hint so HeaderMap reserve cannot overflow#833

Merged
seanmonstar merged 1 commit into
hyperium:masterfrom
SAY-5:fix-extend-reserve-overflow
May 13, 2026
Merged

fix: clamp Extend size hint so HeaderMap reserve cannot overflow#833
seanmonstar merged 1 commit into
hyperium:masterfrom
SAY-5:fix-extend-reserve-overflow

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented May 12, 2026

Both Extend impls pass the iterator's size hint straight to reserve, but that hint can exceed the number of names the table is able to index (e.g. when the iterator yields many appended values for one name), causing a MaxSizeReached panic for input that the map can actually hold. This clamps the reservation to the largest value reserve will accept.

Closes #604

Copy link
Copy Markdown
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@seanmonstar seanmonstar merged commit 6e2dd42 into hyperium:master May 13, 2026
10 checks passed
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.

HeaderMap::from_iter panics when size is known

2 participants