From e983987563128be7ff70da3cbc1d9fddb03bfe3a Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Fri, 10 Nov 2017 09:09:46 +0100 Subject: [PATCH] Check retx.sn exists in tx_window in required buffer size --- lib/src/upper/rlc_am.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 96405e22a..0d3d8e426 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -1148,7 +1148,13 @@ bool rlc_am::add_segment_and_check(rlc_amd_rx_pdu_segments_t *pdu, rlc_amd_rx_pd int rlc_am::required_buffer_size(rlc_amd_retx_t retx) { if(!retx.is_segment){ - return rlc_am_packed_length(&tx_window[retx.sn].header) + tx_window[retx.sn].buf->N_bytes; + if (tx_window.count(retx.sn)) { + return rlc_am_packed_length(&tx_window[retx.sn].header) + tx_window[retx.sn].buf->N_bytes; + } else { + log->console("retx.sn=%d does not exist\n"); + log->warning("retx.sn=%d does not exist in required_buffer_size()\n"); + return -1; + } } // Construct new header