Skip to content

fix(pcap): _make_magic ignores nanosecond with explicit endian flags; _read_protos ignores size #1096

Description

@JarryShaw

Describe the bug
misc/pcap/header.py:343-349: when lilendian/bigendian are given, _make_magic returns the microsecond magic whatever nanosecond says. header.py:317 _read_protos(size) ignores size, and nothing calls it.

Reproduction

Arguments Got Expected
(lilendian=True, bigendian=False, nanosecond=True) 4d3cb2a1 nanosecond little-endian magic
(lilendian=False, bigendian=True, nanosecond=True) a1b2c3d4 nanosecond big-endian magic
byteorder='big', nanosecond=True a1b23c4d a1b23c4d (correct)

_read_protos with size of 0, 4 or 99 always returns (4, {'lilendian': True}).

Expected behavior
The endian-flag branch honours nanosecond. _read_protos is fixed or removed.

System information
main at b10e7951b, CPython 3.14.7, Linux.

Additional context
Found during the #719 second-round sweep, then reproduced on main.

Activity

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