Repository navigation
fix(pcap): _make_magic ignores nanosecond with explicit endian flags; _read_protos ignores size - #1112
Merged
Conversation
… _read_protos ignores size - _make_magic: the lilendian/bigendian branch hard-coded the magic, always nanosecond for little-endian and microsecond for big-endian. It now looks up _MAGIC_NUM with the nanosecond flag, as the byteorder branch does. - Header._read_protos: read `size` bytes instead of a fixed 4, matching Link._read_protos and Internet._read_protos. - test_header_frame_unit pinned the old little-endian nanosecond magic for lilendian=True with nanosecond=False; corrected to d4c3b2a1. Closes #1096
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.74% (unit tier, Python 3.14,
Per-file detail: the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
header.pydirectly: no messages on changed lines;maketargets not runmake testpasses, and a test case covers the change — only the modules listed belowWhat is the purpose of your pull request?
fix— corrects a defectDescription
Closes #1096.
_make_magic's endian-flag branch now looks up_MAGIC_NUM[(endian, nanosecond)].Header._read_protosnow readssizebytes, likeLink/Internet. It is kept rather than removed because it overrides theProtocolBase._read_protoshook and an existing test calls it._make_magic(lil, big, nsec)(T, F, F)4d3cb2a1d4c3b2a1(F, T, T)a1b2c3d4a1b23c4d_read_protos(1/2)consumed 4 bytes before the fix and consumes 1/2 after it.test_header_frame_unitpinned the old(T, F, F)magic, so that assertion is corrected.Tests: the new
tests/protocols/misc/pcap/test_header_magic_protos_unit.pyfails without the fix (6 subtests, 3 passed) and passes with it (3 passed, 11 subtests).test_header_frame_unitpasses 6 of 6,dumpkit/test_common_unit14,test_option_roundtrip_unit6, andtests/project379 passed, 1 skipped.