diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2020-02-11 05:39:06 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2020-02-11 05:58:44 +0700 |
commit | 5574a58cd6466adff75c7b96a82ef1173bdcf4e2 (patch) | |
tree | 8d485043cfdcb8156b68f9f1771267899d62100f /tests/rlcmac/RLCMACTest.ok | |
parent | fee767f21cfc648606c7a0cf15888ae6c227eeaf (diff) |
csn1: fix csnStreamDecoder(): catch unknown CSN_CHOICE values
After the recent changes [1], it was noticed that one of the unit
tests fails. In particular, a decode-encode cycle of Packet
Polling Request produces a different vector:
vector1 = 49 13 e0 08 50 88 40 13 a8 04 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 49 13 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : FALSE
As it turns out, the original (input) vector itself is malformed
because it contails no valid identity, and thus violates the
specs. The CSN.1 decoder from Pycrate [2] throws an exception
while trying to decode it. I believe we should do the same.
Let's stop decoding the bit stream and return an error in case
if neither of a given list of the choice items matched.
[1] Ia0f8cc224a4c38e80699f834fd83d4c0d99322ea
[2] https://github.com/P1sec/pycrate
Change-Id: I420144773ed5e80372534e0f18db5e74cdb2999d
Fixes: OS#4392
Diffstat (limited to 'tests/rlcmac/RLCMACTest.ok')
-rw-r--r-- | tests/rlcmac/RLCMACTest.ok | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/rlcmac/RLCMACTest.ok b/tests/rlcmac/RLCMACTest.ok index 24ea4b7d..2d27ca43 100644 --- a/tests/rlcmac/RLCMACTest.ok +++ b/tests/rlcmac/RLCMACTest.ok @@ -58,11 +58,11 @@ vector2 = 40 24 03 0f 2f 00 00 00 00 87 b0 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b vector1 == vector2 : TRUE vector1 = 4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b =========Start DECODE=========== -+++++++++Finish DECODE (0)++++++++++ ++++++++++Finish DECODE (-8)++++++++++ =========Start ENCODE============= +++++++++Finish ENCODE (0)+++++++++++ vector1 = 49 13 e0 08 50 88 40 13 a8 04 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b -vector2 = 49 13 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b +vector2 = 49 13 00 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b vector1 == vector2 : FALSE vector1 = 412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b =========Start DECODE=========== |