Repository navigation
fix(pcapng)!: keep an SHB or IDB shorter than its fixed fields as captured (#1422) - #1425
Merged
Merged
Conversation
…tured (#1422) - SHB below 28 octets and IDB below 20 read their fixed fields past the Block Total Length and rebuilt at the full fixed size. The body is now kept as `block_raw`, which make() writes back at the declared length, as #1420 does for EPB/PB; fields the block holds are decoded, the rest read as zero, and options are empty. - The schemas skip the length/length2 comparison for such blocks; the reader compares the real trailing copy itself. - A 12-octet SHB has no room for its Byte-Order Magic, so it takes the byte order in which its Block Total Length reads as 12. A bad magic on any other length still raises ProtocolError. - New regression module for #1422.
JarryShaw
force-pushed
the
fix/1422-pcapng-short-shb-idb
branch
from
October 8, 2026 17:57
136d42c to
08dfbb0
Compare
Contributor
|
Coverage: 89.45% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
Verdict: GOOD TO GO at
Note, not blocking: a 12-octet IDB has no link type, so it reads as |
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.
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort) — run on the changed files; no new findings beyond line length matching the neighbouring_read_block_shortmake testpasses, and a test case covers the change —tests/protocols/miscper module,tests/project, andrun_unittest_leg.py protocols --exclude protocols/internetonlyAdded a changelog entry — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657
fix— corrects a defectCloses #1422
Byte-exact rebuild (
PCAPNG.from_data(PCAPNG(raw).info).data), before → after, both byte orders: SHB 16→28 ⇒ 16, 20→28 ⇒ 20, 24→28 ⇒ 24; SHB 12 raisedProtocolError⇒ 12; IDB 12→20 ⇒ 12, 16→20 ⇒ 16. Full SHB (28) and IDB (20) unchanged.block_rawand written back bymake(), as fix(pcapng)!: keep malformed journal entries and short packet blocks as captured (#1413, #1414) #1420 does for EPB/PB. Fields the block holds are decoded, the rest read as zero. Contract change: such blocks gainblock_rawand no longer report fields over-read from the next block.ProtocolError.Tests: new
test_pcapng_short_shb_idb_1422_unit.py(8 tests, 60 subtests). Without the fix, 47 subtests and the extraction test fail. Rebased onto949b0a900, which empties that staleKNOWN_GAPSallowlist;test_bitfield_coverage_unit.pynow passes on this head.tests/project: 404 passed, 1 skipped.