[Asterisk-code-review] res_rtp_asterisk: Ensure sufficient space for worst case NACK. (asterisk[certified/16.8])

Friendly Automation asteriskteam at digium.com
Thu Mar 26 08:31:49 CDT 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14014 )

Change subject: res_rtp_asterisk: Ensure sufficient space for worst case NACK.
......................................................................

res_rtp_asterisk: Ensure sufficient space for worst case NACK.

ASTERISK-28790

Change-Id: I10df52f98b19ed62575f25dab36e82d136dccd99
---
M res/res_rtp_asterisk.c
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, approved
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Pascal Cadotte Michaud: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 4f736ef..a5b7106 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -7916,12 +7916,15 @@
 			int res = 0;
 			int ice;
 			int sr;
-			size_t data_size = AST_UUID_STR_LEN + 128 + (seqno - rtp->expectedrxseqno) / 17;
+			size_t data_size = AST_UUID_STR_LEN + 128 + (AST_VECTOR_SIZE(&rtp->missing_seqno) * 4);
 			RAII_VAR(unsigned char *, rtcpheader, NULL, ast_free_ptr);
 			RAII_VAR(struct ast_rtp_rtcp_report *, rtcp_report,
 					ast_rtp_rtcp_report_alloc(rtp->themssrc_valid ? 1 : 0),
 					ao2_cleanup);
 
+			/* Sufficient space for RTCP headers and report, SDES with CNAME, NACK header,
+			 * and worst case 4 bytes per missing sequence number.
+			 */
 			rtcpheader = ast_malloc(sizeof(*rtcpheader) + data_size);
 			if (!rtcpheader) {
 				ast_debug(1, "Failed to allocate memory for NACK\n");

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

Gerrit-Project: asterisk
Gerrit-Branch: certified/16.8
Gerrit-Change-Id: I10df52f98b19ed62575f25dab36e82d136dccd99
Gerrit-Change-Number: 14014
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Pascal Cadotte Michaud <pcm at wazo.io>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200326/7d4c7e7d/attachment.html>


More information about the asterisk-code-review mailing list