Repository navigation
Conversation
…beholder (#2516) Problem: _parse_next_layer held a trial's warnings only when the capture was short of the layer's hint, but beholder replaces a layer that raises at any length. A TCP segment to 443 that starts mid-record warned "packet length < 0" twice (TLS's record header, then the SSLv2 fallback) for a TLS layer kept as Raw. Fix: hold whenever beholder is active, or the capture is short of the hint. A raising layer's warnings go with it; a kept layer reports them as its parse ends, after the layers it carries. Test: tests/protocols/test_trial_parse_full_length_2516_unit.py; the #1580 test that pinned the leak now pins a parse outside beholder. Trial-parse, TLS/SSL/DTLS and related project modules pass.
|
Cross-review (Sonnet) at Non-blocking, to fold in as a follow-up commit unless this merges first: the half of the docstring about holding outside |
|
Decisions needed before merge: Q1. Warning order along a kept chain. Each held block reports when its parse ends, so an outer layer's warning now comes after its inner layers'. Example: IPv4 with a bad Security option carrying a cut Shim6 header. The set of warnings and their source lines are unchanged; the fuzz found 5 reordered cases in 6000. Options: 1. accept it (it is documented in the Note and pinned by a test); 2. redesign nesting, which collides with the Q2. |
|
take your recommendations on both questoins |
|
Owner took both recommendations. Q1: the new warning order along a kept chain is accepted as documented. Q2: the #2308 rule applies to |
|
Coverage: 93.94% (unit tier, Python 3.15,
Per-file detail: the |
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseconst— regenerates constant or registry tables, members keeping their numeric valuesDescription of your pull request and other information
Closes #2516.
Protocol._parse_next_layerheld a trial parse's warnings only when the capture was shorter than the layer's length hint. A full-length layer that then raised still reported itsSchemaWarnings beforebeholderreplaced it withRaw, against #1580/#2308. One example is a mid-record TCP 443 segment: TLS's header read plus its SSLv2 fallback trial. #2339 had listed this case as left out._parse_next_layernow holds wheneverbeholderis active, not only on a short capture. Its Note andwarnings.rstsay so.test_trial_parse_full_length_2516_unit.pycovers the repro, a cut SSLv2 hello, a raising TCP header under IPv4 and IPv6, and two controls. The fix(protocols): a trial next-layer parse that is replaced by Raw still emits its SchemaWarnings #1580 test is retargeted. 6 and 1 tests fail without the fix.One behaviour change to confirm: along a kept chain, an outer layer's warnings now report after its inner layers'. The set of warnings and their source lines are unchanged. This will be raised as a question here once the review lands.