aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-24 17:52:16 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-03-24 17:52:16 +0100
commit925ecf59c1275d6302f914f4c6be2a4a042432d5 (patch)
tree829a316263b0616821074661e760e1aa257fde70
parentdfc57ff5c9d5af81efaf17f43c83780264d7d22b (diff)
downloaddabmux-925ecf59c1275d6302f914f4c6be2a4a042432d5.tar.gz
dabmux-925ecf59c1275d6302f914f4c6be2a4a042432d5.tar.bz2
dabmux-925ecf59c1275d6302f914f4c6be2a4a042432d5.zip
Pull add14d9: Properly handle EDI AF SEQ rollover
-rw-r--r--lib/edi/common.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/edi/common.cpp b/lib/edi/common.cpp
index c892425..470b3ba 100644
--- a/lib/edi/common.cpp
+++ b/lib/edi/common.cpp
@@ -242,7 +242,9 @@ decode_state_t TagDispatcher::decode_afpacket(
return {false, 0};
}
- if (m_last_seq + (uint16_t)1 != seq) {
+ // SEQ wraps at 0xFFFF, unsigned integer overflow is intentional
+ const uint16_t expected_seq = m_last_seq + 1;
+ if (expected_seq != seq) {
etiLog.level(warn) << "EDI AF Packet sequence error, " << seq;
}
m_last_seq = seq;