Repository navigation
fix(httpv2): SETTINGS ListField reads past the last pair and warns 'packet length < 0' - #1146
Merged
Merged
Conversation
…acket length < 0' SettingsFrame.settings built each SettingPair as a SchemaField with no length, so the nested schema started from a __length__ of -1 and warned 'packet length < 0' at -3 and -7 for every pair. Give the item its fixed 6-octet size, as TCP SACK and SCTP gap-ack blocks already do. Closes #1140
Owner
Author
|
Cross-review verdict on
The same length-less pattern also appears in |
Contributor
|
Coverage: 88.75% (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.
make pylint,make mypy,make isort) — isort clean, mypy 0 errors in the touched file; pylint not run with project flagsmake testpasses, and a test case covers the change — the modules listed below onlyWhat 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 elseDescription of your pull request and other information
Closes #1140.
SettingsFrame.settingsbuilt eachSettingPairas aSchemaFieldwith no length, so the nested schema began at__length__ = -1and warned at-3and-7for every pair. The ListField loop itself stops correctly. The fix gives the item its fixed 6-octet size, as TCP SACK (length=8) and SCTP gap-ack (length=4) already do.Probe (1 pair,
0x0001 = 4096): before,['packet length < 0: -3', 'packet length < 0: -7']. After,[]. Malformed 5, 7 and 9-octet payloads still raiseProtocolError, now without the warnings.Test. The new
tests/protocols/application/test_httpv2_settings_list_1140_unit.pycovers 0, 1, 2 and 6 pairs plus an ACK, with frames packed by scapy 2.7.0contrib.http2. It asserts zero warnings and a byte-for-byte parse→makeround trip. Without the fix:3 failed, 2 passed, 7 subtests passed(1, 2 and 6 pairs). With it:2 passed, 10 subtests passed.Also passing:
test_httpv2_frame_length_1121_unit(5),test_httpv2_negative_length_unit(5),test_httpv2_payload_length_unit(23),test_http_unit(65),test_option_roundtrip_unit(6),test_enum_lookup_reparent_877_unit(37) andtests/project(385 passed, 1 skipped).