forked from osmocom/wireshark
tcp: Throw exception instead of ASSERT for unknown PDU length
If a subdissector requests one more segment for a PDU of unknown length, but we can't do reassembly for whatever reason, that's not necesarily a dissector bug (while it could be the result of a bad heuristic, it can happen from a checksum failing validation or reassembly preferences disabled.) The correct error is a FragmentBoundsError (dissector requested bytes that it couldn't get due to not being reassembled), which is what we would also throw if the returned PDU length were greater than the tvb length instead of unknown. Fix #16689.
This commit is contained in:
parent
c79e35d45c
commit
b5989badb4
|
@ -4049,7 +4049,16 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
* Support protocols which have a variable length which cannot
|
||||
* always be determined within the given fixed_len.
|
||||
*/
|
||||
DISSECTOR_ASSERT(proto_desegment && pinfo->can_desegment);
|
||||
/*
|
||||
* If another segment was requested but we can't do reassembly,
|
||||
* abort and warn about the unreassembled packet.
|
||||
*/
|
||||
THROW_ON(!(proto_desegment && pinfo->can_desegment), FragmentBoundsError);
|
||||
/*
|
||||
* Tell the TCP dissector where the data for this message
|
||||
* starts in the data it handed us, and that we need one
|
||||
* more segment, and return.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue