Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5252 +/- ##
==========================================
+ Coverage 80.41% 80.45% +0.03%
==========================================
Files 376 376
Lines 98405 98401 -4
==========================================
+ Hits 79137 79167 +30
+ Misses 19268 19234 -34
🚀 New features to boost your workflow:
|
guess_payload_class() and both pre_dissect() loops re-sliced the remaining buffer for every header field, so dissecting a header with N fields copied the whole remainder N times. Add tcpros_iter_field_lengths(), which unpacks each length with struct.unpack_from() and advances an offset, and use it in the three places that walked the field list. The end-of-buffer check in guess_payload_class() becomes an offset comparison instead of comparing the declared length with the length of a freshly built slice. Cover the traversal, the offset start, a 300-field header and the conf.debug_dissector output in test/contrib/tcpros.uts.
Eapp1e
force-pushed
the
perf/tcpros-field-lengths
branch
from
October 25, 2026 14:27
63dbae4 to
0772fb7
Compare
Author
|
The Codecov comment above predates the current head ( So the patch should be fully covered on re-run; the stale 86.67% is from the previous commit ( |
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.
scapy/contrib/tcpros.pyparses its field lists by re-slicing the remaining buffer on every field (guess_payload_class,TCPROSHeader.pre_dissect,TCPROSBody.pre_dissect), so every field copies the rest of the buffer.This reads the field lengths in place with
struct.unpack_from()through a sharedtcpros_iter_field_lengths()helper. The parsing result is unchanged; on a header of 8000 fields,TCPROS.guess_payload_class()goes from 32.7 ms to 1.8 ms.Closes #5244
This message was written with the help of AI.