aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-02 02:15:26 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-14 01:26:34 +0000
commit024152683646f1b68c85de74f783b81db51d16b5 (patch)
tree087fd8b44c6b2e0693e5f2c48aed5526259e6b03 /tests
parent9f5f008aedc910ff0ce18bf3f92b9b74f0438bf8 (diff)
Fix CSN1 decoding: CSN_LEFT_ALIGNED_VAR_BMP bounds
Fix attempted read past vector boundaries in case of a starting bit offset != 0, so that the last amount of bits read should be < 8. In the case of CSN_LEFT_ALIGNED_VAR_BMP, the mod-8 calculation was flawed, and in the final step, 8 bits were read instead of the remainder < 8. This lead to -EINVAL being returned by bitvec_get_bit_pos() and bogus resulting data. Instead, read 8 bits only as long as at least 8 bits remain, and read any remaining bits < 8 in a final step. Drop unneeded nB1 variable and an obvious comment. Adjust the unit test assertion in testCsnLeftAlignedVarBmpBounds() in RLCMACTest.cpp. Based on a fix by Aravind Sirsikar <Arvind.Sirsikar@radisys.com>, but implemented differently. Related: OS#1805 Change-Id: I490498c8da6b531f54acb673379379f7b10907c0
Diffstat (limited to 'tests')
-rw-r--r--tests/rlcmac/RLCMACTest.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index f633dd8..97e5e60 100644
--- a/tests/rlcmac/RLCMACTest.cpp
+++ b/tests/rlcmac/RLCMACTest.cpp
@@ -223,13 +223,8 @@ void testCsnLeftAlignedVarBmpBounds()
&data.u.Egprs_Packet_Downlink_Ack_Nack.EGPRS_AckNack.Desc;
decode_gsm_rlcmac_uplink(vector, &data);
- /*
- * TODO: URBB len is decoded as 102 bits. So 96 + 6 bits = 12 bytes + 6
- * bits should be decoded. The 13th byte should end up as 0x00, but we
- * see data coming from bitvec_get_bit_pos() returning -EINVAL.
- */
OSMO_ASSERT(!strcmp(osmo_hexdump(urbb->URBB, 13),
- "7f ff ff ee 00 00 00 00 00 00 00 00 ea "));
+ "7f ff ff ee 00 00 00 00 00 00 00 00 00 "));
}
int main(int argc, char *argv[])