Skip to content

fix(toolkit): the pypcapfile engine reads a TCP Data Offset below 5 as a 20-octet header #1590

Closed

Description

@JarryShaw

With engine='pypcapfile', a TCP segment whose Data Offset is below 5 is read as if its header were 20 octets. The default engine rejects such a segment.

Repro on main (e9f3340f7), Python 3.11, pypcapfile 0.12.0: Ethernet + IPv4 + a TCP header with Data Offset 4 and payload data.

  • Default engine: no TCP datagram, because pcapkit/toolkit/pcap.py:135-136 drops a header shorter than 20 octets.
  • pypcapfile: one TCP datagram with payload b'data', plus a flow.

Cause: pcapkit/toolkit/pypcapfile.py:724 and :797 compute max(tcp.data_offset, TCP_MIN_HEADER_LEN), and _transport (:467) checks only the length.

Expected: a Data Offset below 5 means no TCP input, as with the default engine.

Found by the #1575 worker and its cross-review; I reproduced it independently. Blocked until #1575 merges, because the fix is in the same file.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 10, 2026
  2. moved this to Blocked in PyPCAPKiton Oct 10, 2026
  3. JarryShaw commented on Oct 10, 2026

    @JarryShaw
    OwnerAuthor

    Work has started ahead of #1575 merging, together with #1590–#1593 and #1596 because all five are in the same pypcapfile.py header walk. It is on a branch built on #1575's head 1de91947b. The PR opens, rebased onto main, once #1575 merges.

  4. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 10, 2026
  5. moved this from Blocked to WIP in PyPCAPKiton Oct 10, 2026
  6. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions