Skip to content

fix(http): correct brotli decompressor buffer capacity to 8 KiB - #4228

Draft
Sruhvx-jpg wants to merge 1 commit into
actix:mainfrom
Sruhvx-jpg:fix/brotli-decoder-buffer-capacity
Draft

fix(http): correct brotli decompressor buffer capacity to 8 KiB#4228
Sruhvx-jpg wants to merge 1 commit into
actix:mainfrom
Sruhvx-jpg:fix/brotli-decoder-buffer-capacity

Conversation

@Sruhvx-jpg

@Sruhvx-jpg Sruhvx-jpg commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the misaligned 8_096 buffer capacity typo in actix_http::encoding::Decoder when initializing the Brotli decompressor writer, replacing it with DEFAULT_DECODER_CAPACITY = 8 * 1024 (8 KiB) to ensure clean virtual memory page and allocator size-class alignment.

Context

  • In actix-http/src/encoding/decoder.rs, 8_096 was passed to brotli::DecompressorWriter::new().
  • Standard system memory pages are 4 KiB (4,096 bytes), making 8,192 a clean 2-page power-of-two boundary ( \times 1024$). 8_096 was an accidental typo for 8192 (,192 - 96$).
  • The encoding module elsewhere already standardizes on 8 KiB (e.g. Writer pre-allocates 8 KiB) and 32 KiB (encoder.rs).

Stacked PR Note

This PR is kept strictly minimal (~6 lines) to make review trivial. A stacked PR adding comprehensive unit test coverage for Decoder across sub-page, boundary, and multi-page chunks is ready and will follow right on top of this.


Note: Burned my hand today so typing is a bit slow, will submit the other audited fixes from the telemetry report tomorrow!

Replace the misaligned `8_096` buffer capacity literal in the Brotli
decompressor writer initialization with `8 * 1024` (8 KiB) to ensure
clean memory page and allocator size-class alignment.
@Sruhvx-jpg Sruhvx-jpg changed the title test fix(http): correct brotli decompressor buffer capacity to 8 KiB Sep 6, 2026
@github-actions github-actions Bot added the A-http project: actix-http label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-http project: actix-http

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant