Change in gapk[master]: don't assert just because a broken RTP packet (wrong lenth) is received

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Jul 1 08:09:01 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/gapk/+/18930 )

Change subject: don't assert just because a broken RTP packet (wrong lenth) is received
......................................................................

don't assert just because a broken RTP packet (wrong lenth) is received

Change-Id: I373308ed40614d29d9b578ddc056f27e20e4aa21
---
M src/fmt_rtp_efr.c
M src/fmt_rtp_hr_etsi.c
M src/fmt_rtp_hr_ietf.c
3 files changed, 15 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  tnt: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/fmt_rtp_efr.c b/src/fmt_rtp_efr.c
index accfd4f..7afb1a3 100644
--- a/src/fmt_rtp_efr.c
+++ b/src/fmt_rtp_efr.c
@@ -52,7 +52,11 @@
 {
 	int i;
 
-	assert(src_len == EFR_LEN);
+	/* broken RTP frames may be short; substitute empty frame */
+	if (src_len != EFR_LEN) {
+		memset(dst, 0, EFR_CANON_LEN);
+		return EFR_CANON_LEN;
+	}
 
 	for (i=0; i<(EFR_LEN-1); i++)
 		dst[i] = (src[i] << 4) | (src[i+1] >> 4);
diff --git a/src/fmt_rtp_hr_etsi.c b/src/fmt_rtp_hr_etsi.c
index 9ed9b22..0b7e392 100644
--- a/src/fmt_rtp_hr_etsi.c
+++ b/src/fmt_rtp_hr_etsi.c
@@ -42,7 +42,11 @@
 rtp_hr_etsi_to_canon(uint8_t *dst, const uint8_t *src, unsigned int src_len)
 {
 	/* according to TS 101 318 */
-	assert(src_len == HR_CANON_LEN);
+	/* broken RTP frames may be short; substitute empty frame */
+	if (src_len != HR_CANON_LEN) {
+		memset(dst, 0, HR_CANON_LEN);
+		return HR_CANON_LEN;
+	}
 	memcpy(dst, src, src_len);
 
 	return HR_CANON_LEN;
diff --git a/src/fmt_rtp_hr_ietf.c b/src/fmt_rtp_hr_ietf.c
index 4ee548f..a840d4b 100644
--- a/src/fmt_rtp_hr_ietf.c
+++ b/src/fmt_rtp_hr_ietf.c
@@ -60,7 +60,11 @@
 rtp_hr_ietf_to_canon(uint8_t *dst, const uint8_t *src, unsigned int src_len)
 {
 	/* according to RFC5993 */
-	assert(src_len == HR_LEN);
+	/* broken RTP frames may be short; substitute empty frame */
+	if (src_len != HR_LEN) {
+		memset(dst, 0, HR_LEN);
+		return HR_CANON_LEN;
+	}
 
 	/* Remove ToC byte */
 	memcpy(dst, src+1, HR_CANON_LEN);

-- 
To view, visit https://gerrit.osmocom.org/c/gapk/+/18930
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Change-Id: I373308ed40614d29d9b578ddc056f27e20e4aa21
Gerrit-Change-Number: 18930
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Assignee: tnt <tnt at 246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-CC: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200701/7940fbee/attachment.htm>


More information about the gerrit-log mailing list