Skip to content

fix(corekit): a length-less SchemaField passes -1 to its schema, so every list item warns 'packet length < 0' #1148

Closed

Description

@JarryShaw

Describe the bug
A SchemaField declared without a length passes -1 to the nested schema as its remaining length. As each sub-field reads, the count goes further negative, so every item of a ListField built from such items emits SchemaWarning: packet length < 0. The bytes are still parsed correctly, but the warnings are spurious.

#1146 fixes this for HTTP/2 SETTINGS by giving the item a fixed length=6. The same pattern exists elsewhere with variable-length items, which cannot be given a fixed length:

  • pcapkit/protocols/schema/internet/mh.py:907 (CGAParameter)
  • pcapkit/protocols/schema/internet/hip.py:633 (Locator)

Expected behavior
A length-less SchemaField does not report a negative remaining length. Either the nested schema is told the true remaining length, or it gets a sentinel value that the length check ignores.

Additional context
Found by the #1140 worker. Not yet reproduced on mh or hip.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 6, 2026
  2. added a commit that references this issue on Oct 6, 2026
    e233a73
  3. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 6, 2026
  4. added this to the PyPCAPKit v1.5 milestone on Oct 25, 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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions