[Asterisk-code-review] pjproject: Add patch to fix trailing whitespace issue in rtpmap (asterisk[16])

Kevin Harwell asteriskteam at digium.com
Wed Sep 15 12:45:00 CDT 2021


Kevin Harwell has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16485 )

Change subject: pjproject: Add patch to fix trailing whitespace issue in rtpmap
......................................................................

pjproject: Add patch to fix trailing whitespace issue in rtpmap

An issue was found where a particular manufacturer's phones add a
trailing space to the end of the rtpmap attribute when specifying
a payload type that has a "param" after the format name and clock
rate. For example:

a=rtpmap:120 opus/48000/2 \r\n

Because pjmedia_sdp_attr_get_rtpmap currently takes everything after
the second '/' up to the line end as the param, the space is
included in future comparisons, which then fail if the param being
compared to doesn't also have the space.

We now use pj_scan_get() to parse the param part of rtpmap so
trailing whitespace is automatically stripped.

ASTERISK-29654

Change-Id: Ibd0a4e243a69cde7ba9312275b13ab62ab86bc1b
---
A third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch
1 file changed, 32 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, approved



diff --git a/third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch b/third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch
new file mode 100644
index 0000000..1b1fcad
--- /dev/null
+++ b/third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch
@@ -0,0 +1,32 @@
+From 2ae784030b0d9cf217c3d562af20e4967f19a3dc Mon Sep 17 00:00:00 2001
+From: George Joseph <gjoseph at sangoma.com>
+Date: Tue, 14 Sep 2021 10:47:29 -0600
+Subject: [PATCH] pjmedia_sdp_attr_get_rtpmap: Strip param trailing whitespace
+
+Use pj_scan_get() to parse the param part of rtpmap so
+trailing whitespace is automatically stripped.
+
+Fixes #2827
+---
+ pjmedia/src/pjmedia/sdp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pjmedia/src/pjmedia/sdp.c b/pjmedia/src/pjmedia/sdp.c
+index 5d05a0d9c..3448749c9 100644
+--- a/pjmedia/src/pjmedia/sdp.c
++++ b/pjmedia/src/pjmedia/sdp.c
+@@ -313,9 +313,9 @@ PJ_DEF(pj_status_t) pjmedia_sdp_attr_get_rtpmap( const pjmedia_sdp_attr *attr,
+ 
+ 	/* Expecting either '/' or EOF */
+ 	if (*scanner.curptr == '/') {
++	    /* Skip the '/' */
+ 	    pj_scan_get_char(&scanner);
+-	    rtpmap->param.ptr = scanner.curptr;
+-	    rtpmap->param.slen = scanner.end - scanner.curptr;
++	    pj_scan_get(&scanner, &cs_token, &rtpmap->param);
+ 	} else {
+ 	    rtpmap->param.slen = 0;
+ 	}
+-- 
+2.31.1
+

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ibd0a4e243a69cde7ba9312275b13ab62ab86bc1b
Gerrit-Change-Number: 16485
Gerrit-PatchSet: 3
Gerrit-Owner: George Joseph <gjoseph at digium.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-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210915/46848c93/attachment.html>


More information about the asterisk-code-review mailing list