Repository navigation
fix(dpkt): extract(engine='dpkt') keeps a frame dpkt cannot parse instead of leaking AttributeError (#1351) - #1377
Merged
Merged
Conversation
… an IPv6 Fragment header followed by ESP or Destination Options - read_frame: a frame dpkt fails to parse is kept as a raw packet with a DPKTWarning, as the default and scapy engines fall back to a raw payload, instead of letting the third-party exception end the extraction. dpkt 1.9.8 raises AttributeError from ip6.py for an IPv6 Fragment header followed by ESP or Destination Options (#1351). - _get_raw_protocol: the raw packet class, shared with the unrecognised-link-type path.
Owner
Author
|
Cross-review verdict on
Nits: the test does not pin |
Contributor
|
Coverage: 87.06% (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.
Please follow the guide below
make pylint,make mypy,make isort) — run ondpkt.pywith the Makefile flags: mypy clean, isort clean, pylint adds only one more_frnumprotected-access of the kind the file already hasmake testpasses, and a test case covers the change — the modules listed below, not the whole suiteWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1351
dpkt 1.9.8
dpkt/ip6.py:96raisesAttributeErrorfor an IPv6 Fragment header followed by ESP (50) or Destination Options (60).engines/dpkt.py:164(packet = protocol(pkt)) did not catch it.read_framenow catches the parse failure, warnsDPKTWarning(Frame N: dpkt cannot parse the frame (...); kept as raw data) and keeps the frame as the raw packet class. That class is now_get_raw_protocol(), shared with the unrecognised-link-type path.Why skip-with-warning, not an error: the default engine (
ProtocolBase.analyze) falls back toRawon any exception, and scapy dissects a failure as aRawlayer. Neither ends the extraction, so frame numbering stays in step with them.Before/after (
followups-d5-50.pcap,-60.pcap):AttributeError: 'IP6ESPHeader' / 'IP6DstOptsHeader' object has no attribute 'frag_off'-> 1 frame, bytes intact, one warning.Tests: new
tests/foundation/engines/test_dpkt_parse_error_unit.pypasses (2 subtests); withorigin/main'sdpkt.pyboth subtests fail with theAttributeError.run_unittest_leg.py toolkit287 tests OK;test_engine_parity.py5 passed;test_reassembly_engine_parity.py5 passed;tests/project389 passed, 1 skipped.test_runtime_engines.pyhas 2 failures (test_pcap_run_writes_global_header_for_file_and_stream_modes); they fail the same way onorigin/main, outside this change.