Skip to content

fix(application): parse an HTTP/2 SETTINGS frame cut inside its settings (#2659) - #2666

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2659-httpv2-settings-cut
Nov 2, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2659-httpv2-settings-cut

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — fixes a bug

Description of your pull request and other information

An HTTP/2 SETTINGS frame cut short by the capture parses as far as its octets go, and rebuilds as captured. It used to raise a loud FieldValueError from ListField's #431 guard.

A Sonnet cross-review returned GOOD TO GO after two rounds. Across its differentials (1658 cuts, 9072 whole frames, 12078 length mismatches), only SETTINGS changes. Every refusal and edge is pinned. #2665 tracks a separate defect the work found: a cut frame after the connection preface.

Closes #2659

…ngs (#2659)

A SETTINGS frame the capture cuts short falls back to Raw. Its settings list
is sized by the frame's Length, so past the octets present a SettingPair
consumes nothing, and ListField.unpack refuses it as a loop making no progress.

- SettingPairListField sizes SettingsFrame.settings by the octets present: the
  setting the data ends inside is kept as far as it goes, and Schema.unpack
  records the short read. ListField is unchanged.
- HTTPv2.make takes frame_length, which HTTPv2._make_data passes through. One
  that is no int from the frame's own Length to 0xFFFFFF, or above it before a
  payload, raises ProtocolError (#2617).
- HTTPv2.pack has a frame made short of its Length parsed back at that Length,
  as the capture was, rather than refused by HTTPv2.read.
- Tests: cuts at every offset through TCP and through HTTPv2, a whole frame,
  the next frame left alone, the field on bytes and a stream, frame_length's
  refusals and edges, a dict with no length, and the short-read sweep.

HTTP, HTTP/2, schema, sweep, doc-claim and member-order modules pass;
captures parse identically to main.
@JarryShaw JarryShaw added this to the PyPCAPKit v1.6 milestone Nov 2, 2026
@JarryShaw JarryShaw added fix Pull requests that fix a defect (fix: subject prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Nov 2, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 23b080d09, after two Sonnet rounds. Every bad frame_length value raises ProtocolError naming the keyword, including the in-range bool cases and payload=None. Across all three differentials, only cut SETTINGS frames change. Each refusal and edge fails without its check.

@JarryShaw
JarryShaw merged commit 1ea04cc into main Nov 2, 2026
52 of 53 checks passed
@github-project-automation github-project-automation Bot moved this to Done in PyPCAPKit Nov 2, 2026
@JarryShaw
JarryShaw deleted the fix/2659-httpv2-settings-cut branch November 2, 2026 17:39
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 2, 2026
JarryShaw added a commit that referenced this pull request Nov 2, 2026
…he cut-frame fixes and GRE's bindings into 1.6.0 (#2449)

- Breaking: TCP, UDP and SCTP makers (#2670) and PCAP-NG's (#2671) raise
  on a value a field cannot hold, where 1.5.x wrote it masked; each entry
  gives the old and new values. The TTL Diff wraps as before.
- Changed: __index__ returns the LinkType, EtherType, TransType or AppType
  value, ports as ints (#2652); only Create Release waits for a deployment
  approval (#2658). The conventions entry records the index rule.
- Fixed: a cut HTTP/2 SETTINGS frame parses and rebuilds; HTTPv2.make
  takes frame_length (#2666).
- Folded into unreleased entries: FRAD at LinkType 107 and GRE at IP
  protocol 47 (#2667); cut IGMPv3 messages and num_group_records (#2662,
  #2672); Linux_ARPHRD (#2663); DCCP's range checks (#2670); a cut GRE
  frame is TRUNCATED, replacing fold-12's INVALID note, and frame_length
  in pcapkit.utilities.contextvars (#2668).
- No entry for _make_sint's private allow_unsigned, ARP's private
  PAT_MAC_ADDR, or the test- and docs-only d728873, 326a6cf,
  fc80fb1, a37edf1 and 2766707.
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(application): an HTTP/2 SETTINGS frame cut short by the capture raises instead of parsing

1 participant