Skip to content

Fix XPACK relative index underflow#13144

Merged
bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-xpack-relative-index-underflow
May 8, 2026
Merged

Fix XPACK relative index underflow#13144
bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-xpack-relative-index-underflow

Conversation

@bneradt
Copy link
Copy Markdown
Contributor

@bneradt bneradt commented May 8, 2026

XPACK dynamic-table lookups convert absolute match indexes into HPACK relative indexes. A missing guard allowed the unsigned subtraction to wrap if an impossible future absolute index reached that conversion path.

This guards the conversion by returning unmatched results before reading the table head and by rejecting absolute indexes beyond the current head. This also adds XPACK unit coverage for empty, missing, and normal relative lookup results.

@bneradt bneradt added this to the 11.0.0 milestone May 8, 2026
@bneradt bneradt self-assigned this May 8, 2026
@bneradt bneradt requested review from Copilot and maskit May 8, 2026 00:26
XPACK dynamic table lookups convert absolute matches into HPACK
relative indexes. If an impossible future absolute index reached that
conversion path, unsigned subtraction could wrap and report a bogus
relative index.

This guards the conversion by preserving unmatched lookup results and
rejecting absolute indexes beyond the current dynamic-table head before
subtracting. This also adds XPACK unit coverage for empty, missing, and
normal relative lookup results.
@bneradt bneradt force-pushed the fix-xpack-relative-index-underflow branch from 0c8713e to 5205a5c Compare May 8, 2026 00:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens XPACK dynamic-table relative index lookups by preventing unsigned underflow / wraparound when converting an absolute match index into an HPACK-style relative index, especially for empty tables and impossible/invalid match indexes. It also adds unit tests to cover empty, missing, and normal relative-lookup behavior.

Changes:

  • Add guards in XpackDynamicTable::lookup_relative(name, value) to early-return on no-match and reject absolute indexes beyond the current head before subtracting.
  • Add unit test coverage for lookup_relative() returning {index=0, match_type=NONE} on empty tables and missing entries, plus expected relative indexes for normal matches.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/proxy/hdrs/XPACK.cc Prevents relative index underflow by guarding the absolute→relative index conversion on no-match and out-of-range indexes.
src/proxy/hdrs/unit_tests/test_XPACK.cc Adds unit coverage for empty/missing lookups and validates correct relative indexes for existing entries.

@bneradt bneradt merged commit e698e46 into apache:master May 8, 2026
15 checks passed
@bneradt bneradt deleted the fix-xpack-relative-index-underflow branch May 8, 2026 20:56
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x May 8, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x May 14, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 May 14, 2026
@cmcfarlen
Copy link
Copy Markdown
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request May 14, 2026
XPACK dynamic table lookups convert absolute matches into HPACK
relative indexes. If an impossible future absolute index reached that
conversion path, unsigned subtraction could wrap and report a bogus
relative index.

This guards the conversion by preserving unmatched lookup results and
rejecting absolute indexes beyond the current dynamic-table head before
subtracting. This also adds XPACK unit coverage for empty, missing, and
normal relative lookup results.

(cherry picked from commit e698e46)
@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x May 15, 2026
@cmcfarlen cmcfarlen moved this from For v10.1.1 to Picked v10.1.1 in ATS v10.1.x May 18, 2026
@cmcfarlen
Copy link
Copy Markdown
Contributor

Cherry-picked to 10.1.x branch

@cmcfarlen cmcfarlen modified the milestones: 10.2.0, 10.1.3 May 18, 2026
cmcfarlen pushed a commit that referenced this pull request May 18, 2026
XPACK dynamic table lookups convert absolute matches into HPACK
relative indexes. If an impossible future absolute index reached that
conversion path, unsigned subtraction could wrap and report a bogus
relative index.

This guards the conversion by preserving unmatched lookup results and
rejecting absolute indexes beyond the current dynamic-table head before
subtracting. This also adds XPACK unit coverage for empty, missing, and
normal relative lookup results.

(cherry picked from commit e698e46)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.1.1
Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

4 participants