HTTP/2: HPACK integer decoding wraps values above UINT32_MAX

Open Beginner friendly
#1,070 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
networking

Research direction

Start at h2_decode_integer() in the HTTP/2 HPACK codec and trace every caller that consumes header indexes, string lengths and table-size updates. Check the continuation-shift bound before shifting or accumulating so the sum is rejected once it exceeds UINT32_MAX. Then extend the existing HPACK integer tests with UINT32_MAX and UINT32_MAX + 1 vectors; done means both boundary cases decode or reject correctly and the surrounding header-decode tests still pass.

Written by the indexing model from the issue text.

Description

bug

h2_decode_integer() permits a continuation shift of 28 and adds (b & 0x7f) << 28 to a uint32 accumulator. Oversized HPACK integers therefore wrap to small values instead of failing, allowing invalid header indexes, string lengths, and table sizes to be interpreted as valid values. Reject any continuation whose value or final sum exceeds UINT32_MAX before shifting or adding, and add boundary vectors for UINT32_MAX and UINT32_MAX + 1.

Dominant language
C
Stars
16
Forks
7
Avg merge
4h 17m
Merged PRs (30d)
198

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c4punks/CWIST

All issues in c4punks/CWIST

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.