aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2020-03-06 07:21:32 +0700
committerlaforge <laforge@osmocom.org>2020-03-06 21:49:04 +0000
commit2679ec0a9f2fab76c8943adfd588e558688fecc4 (patch)
treef52d38779b676bfd380637cdc0278c362ce73b02 /src
parentf22163b1df0c97c291907646274e4f2b43aadfab (diff)
csn1: fix csnStreamDecoder(): skip bits unhandled by serialize()
This change fixes a bug that was reported by Keith Whyte and confirmed in [1]. The problem is that a user-defined handler in case of CSN_SERIALIZE may parse only a part of the given bit-stream, leaving some bits unhandled. This is expected because the sender (i.e. the MS) may use more recent RLC/MAC message definitions containing new fields at the end. Those bits that were left unhandled by serialize() shall not be interpreted as continuation of the message, they shall be skipped. Note that the encoded vector in the RLCMAC unit test still does not match the original one. That's a known bug explained in [2]. [1] If5873355d52d7ddb06c2716154a88d34100f6ab5 [2] Ic46d6e56768f516203d27d8e7a5adb77afdf32b7 Change-Id: Id4cc042fed68fc54aca0355dcb986cab3f6b49ea Related: OS#4338
Diffstat (limited to 'src')
-rw-r--r--src/csn1.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/csn1.c b/src/csn1.c
index 594e8ec0..21d3662e 100644
--- a/src/csn1.c
+++ b/src/csn1.c
@@ -571,6 +571,13 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, struct bitvec *vector
remaining_bits_len = arT.remaining_bits_len;
bit_offset = arT.bit_offset;
}
+
+ /* Skip bits not handled by serialize(), if any */
+ if (Status > 0) {
+ LOGPC(DCSN1, LOGL_NOTICE, "skipped = %d | ", Status);
+ *readIndex += Status;
+ }
+
pDescr++;
}
else