Skip to main content

check_extension_count

Function check_extension_count 

Source
fn check_extension_count(stated: VarInt, raw: &[u8]) -> Result<(), CodecError>
Expand description

Refuse an Extension Count that disagrees with the extension bytes beside it.

The count and the bytes are two fields with nothing tying them together, and skip_extensions reads exactly count headers on the way back in. A header that states two and carries three leaves the third where the peer expects the Object Payload Length, so every field after it - and every object after that on the same stream - is read at the wrong offset. There is no recovery downstream, which is why this is refused rather than corrected.