]> git.kaiwu.me - nginx.git/commit
HTTP/3: avoid unaligned stores in Huffman encoding
author최대우 (Daewoo Choi) <daewoo.choi@hanwha.com>
Thu, 1 Oct 2026 03:59:44 +0000 (12:59 +0900)
committerAndrew Clayton <a.clayton@nginx.com>
Tue, 20 Oct 2026 12:54:33 +0000 (13:54 +0100)
commitb38c9d8068ab55504aa4311f729803b503579520
treec74132b99a446cec55fd8c2c1c6059cb2e0ec59f
parent4953fc6f02358eb68f8635f24a5bbaf9c71895a1
HTTP/3: avoid unaligned stores in Huffman encoding

The encoder wrote accumulated bits by casting the destination to
uint64_t *, or uint32_t * on 32-bit platforms, and assigning through
it, which requires the destination to be suitably aligned.

In HTTP/2 the destination is a temporary buffer from ngx_palloc() and
is always aligned.  In HTTP/3 it points past a variable number of
prefix integer bytes, so its alignment is arbitrary and the store is
undefined behaviour.

Byte order conversion is now separated from the store, which is done
with ngx_memcpy().
src/http/ngx_http_huff_encode.c