pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/27632 )
Change subject: RLCMAC_EncDec: Fix bug decoding LI[0]=0 ......................................................................
RLCMAC_EncDec: Fix bug decoding LI[0]=0
Change-Id: I86c1b48c922f50013257c8dce405cbad1d77d868 --- M library/RLCMAC_EncDec.cc 1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/32/27632/1
diff --git a/library/RLCMAC_EncDec.cc b/library/RLCMAC_EncDec.cc index 97bd0be..1b56984 100644 --- a/library/RLCMAC_EncDec.cc +++ b/library/RLCMAC_EncDec.cc @@ -513,8 +513,17 @@ if (ret_val.blocks().is_bound()) { for (int i = 0; i < ret_val.blocks().size_of(); i++) { unsigned int length = ret_val.blocks()[i].hdr()().length__ind(); + + /* LI[0]=0 indicates: The current LLC PDU would fit within + current RLC data block but the addition of the length + indicator octet (to indicate the LLC PDU boundary) causes the + LLC PDU to extend into another RLC data block */ + if (i == 0 && length == 0) + length = ttcn_buffer.get_read_len(); + if (length > ttcn_buffer.get_read_len()) length = ttcn_buffer.get_read_len(); + ret_val.blocks()[i].payload() = OCTETSTRING(length, ttcn_buffer.get_read_data()); ttcn_buffer.increase_pos(length); }