summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-21 22:21:30 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-21 22:21:30 +0100
commita9e586cb87705d65f3a3d5903806d222277462be (patch)
tree83da296a3cfb794492a40a3182a45594bd9d3ae6
parentefdf227d7ca96aa9af2d6dc3be623f76b7d1dd60 (diff)
downloaddabmux-a9e586cb87705d65f3a3d5903806d222277462be.tar.gz
dabmux-a9e586cb87705d65f3a3d5903806d222277462be.tar.bz2
dabmux-a9e586cb87705d65f3a3d5903806d222277462be.zip
Add range checks in ESTn EDI Tag
-rw-r--r--src/dabOutput/edi/TagItems.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dabOutput/edi/TagItems.cpp b/src/dabOutput/edi/TagItems.cpp
index afc45a8..1ea7080 100644
--- a/src/dabOutput/edi/TagItems.cpp
+++ b/src/dabOutput/edi/TagItems.cpp
@@ -145,6 +145,17 @@ std::vector<uint8_t> TagESTn::Assemble()
packet.push_back(0);
packet.push_back(0);
+ if (tpl > 0x3F) {
+ throw std::runtime_error("TagESTn: invalid TPL value");
+ }
+
+ if (sad > 0x3FF) {
+ throw std::runtime_error("TagESTn: invalid SAD value");
+ }
+
+ if (scid > 0x3F) {
+ throw std::runtime_error("TagESTn: invalid SCID value");
+ }
uint32_t sstc = (scid << 18) | (sad << 8) | (tpl << 2) | rfa;
packet.push_back((sstc >> 16) & 0xFF);