Fix an incorrect assertion in tlv stream encoding

Types must be unique and monotonically increasing (using < instead of <=)
This commit is contained in:
Omer Yacine 2022-11-02 17:32:47 +02:00
parent 3a33693b1e
commit 0acd5d3e46
No known key found for this signature in database
GPG key ID: C3BED6698142B393

View file

@ -55,7 +55,8 @@ macro_rules! _check_encoded_tlv_order {
($last_type: expr, $type: expr, (static_value, $value: expr)) => { };
($last_type: expr, $type: expr, $fieldty: tt) => {
if let Some(t) = $last_type {
debug_assert!(t <= $type);
#[allow(unused_comparisons)] // Note that $type may be 0 making the following comparison always false
(debug_assert!(t < $type))
}
$last_type = Some($type);
};