Skip to content

IPv6: Compute extension header offset in uint32 to avoid overflow.#13702

Open
agilira wants to merge 1 commit into
google:masterfrom
agilira:fix-ipv6-exthdr-offset
Open

IPv6: Compute extension header offset in uint32 to avoid overflow.#13702
agilira wants to merge 1 commit into
google:masterfrom
agilira:fix-ipv6-exthdr-offset

Conversation

@agilira

@agilira agilira commented Jul 14, 2026

Copy link
Copy Markdown

IPv6PayloadIterator advanced nextOffset by
(length + 1) * ipv6ExtHdrLenBytesPerUnit. Because length is uint8 and ipv6ExtHdrLenBytesPerUnit is the untyped constant 8, the expression was evaluated in uint8 and wrapped for any Hdr Ext Len >= 31, advancing nextOffset by a too-small amount.

nextOffset feeds HeaderOffset() and ParseOffset(), which are used to locate the transport header in the fdbased receive path and to report the ICMP Parameter-Problem pointer. The extension header data itself was already read with correct int math, so this only affects the reported offsets, not memory safety.

Compute the increment in uint32. Add a regression test that parses a Destination Options header with Hdr Ext Len = 31 and checks HeaderOffset().

Assisted-by: Claude Code

IPv6PayloadIterator advanced nextOffset by
(length + 1) * ipv6ExtHdrLenBytesPerUnit. Because length is uint8 and
ipv6ExtHdrLenBytesPerUnit is the untyped constant 8, the expression was
evaluated in uint8 and wrapped for any Hdr Ext Len >= 31, advancing
nextOffset by a too-small amount.

nextOffset feeds HeaderOffset() and ParseOffset(), which are used to
locate the transport header in the fdbased receive path and to report the
ICMP Parameter-Problem pointer. The extension header data itself was
already read with correct int math, so this only affects the reported
offsets, not memory safety.

Compute the increment in uint32. Add a regression test that parses a
Destination Options header with Hdr Ext Len = 31 and checks HeaderOffset().

Assisted-by: Claude Code
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