diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index f7ede089a5..62c1fa90c6 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -185,6 +185,12 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) /* reassemble - free 'data' of each segment after processing */ while (pdu != NULL) { + if (pdu->so > so && !bad_sdu) { + /* pdu->so > so is possible when the other end sends bogus data */ + LOG_E(RLC, "%s:%d:%s: inconsistent SDU, discarding\n", + __FILE__, __LINE__, __FUNCTION__); + bad_sdu = 1; + } int len = pdu->size - (so - pdu->so); if (so + len > NR_SDU_MAX && !bad_sdu) { LOG_E(RLC, "%s:%d:%s: bad SDU, too big, discarding\n", diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index b0ada2e514..a12c991f82 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -139,6 +139,12 @@ static void reassemble_and_deliver(nr_rlc_entity_um_t *entity, int sn) /* reassemble - free 'data' of each segment after processing */ while (pdu != NULL && pdu->sn == sn) { + if (pdu->so > so && !bad_sdu) { + /* pdu->so > so is possible when the other end sends bogus data */ + LOG_E(RLC, "%s:%d:%s: inconsistent SDU, discarding\n", + __FILE__, __LINE__, __FUNCTION__); + bad_sdu = 1; + } int len = pdu->size - (so - pdu->so); if (so + len > NR_SDU_MAX && !bad_sdu) { LOG_E(RLC, "%s:%d:%s: bad SDU, too big, discarding\n",