Skip to content

Commit 111c253

Browse files
new Chrome v98 produces extra sdp attributes, up the limit so we do n… (#1391) (#1393)
* new Chrome v98 produces extra sdp attributes, up the limit so we do not reject * Fix test and change count to unit16 to avoid overflow issues * fix issue reported by codeql Co-authored-by: Divya Sampath Kumar <disa6302@colorado.edu> Co-authored-by: Hassan Sahibzada <hsahibza@amazon.com>
1 parent 22c9e3d commit 111c253

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/source/PeerConnection/SessionDescription.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ STATUS setPayloadTypesFromOffer(PHashTable codecTable, PHashTable rtxTable, PSes
151151
ENTERS();
152152
STATUS retStatus = STATUS_SUCCESS;
153153
PSdpMediaDescription pMediaDescription = NULL;
154-
UINT8 currentMedia, currentAttribute;
154+
UINT8 currentAttribute;
155+
UINT16 currentMedia;
155156
PCHAR attributeValue, end;
156157
UINT64 parsedPayloadType, hashmapPayloadType, fmtpVal, aptVal;
157158
UINT16 aptFmtpVals[MAX_SDP_FMTP_VALUES];

src/source/Sdp/Deserialize.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ STATUS parseMediaName(PSessionDescription pSessionDescription, PCHAR pch, UINT32
55
{
66
ENTERS();
77
STATUS retStatus = STATUS_SUCCESS;
8-
98
CHK(pSessionDescription->mediaCount < MAX_SDP_SESSION_MEDIA_COUNT, STATUS_BUFFER_TOO_SMALL);
109

1110
STRNCPY(pSessionDescription->mediaDescriptions[pSessionDescription->mediaCount].mediaName, (pch + SDP_ATTRIBUTE_LENGTH),
@@ -48,7 +47,7 @@ STATUS parseMediaAttributes(PSessionDescription pSessionDescription, PCHAR pch,
4847
ENTERS();
4948
STATUS retStatus = STATUS_SUCCESS;
5049
PCHAR search;
51-
UINT8 currentMediaAttributesCount;
50+
UINT16 currentMediaAttributesCount;
5251

5352
currentMediaAttributesCount = pSessionDescription->mediaDescriptions[pSessionDescription->mediaCount - 1].mediaAttributesCount;
5453

src/source/Sdp/Sdp.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extern "C" {
7575
#define MAX_SDP_SESSION_MEDIA_COUNT 5
7676
#define MAX_SDP_MEDIA_BANDWIDTH_COUNT 2
7777

78-
#define MAX_SDP_ATTRIBUTES_COUNT 128
78+
#define MAX_SDP_ATTRIBUTES_COUNT 256
7979

8080
/*
8181
* c=<nettype> <addrtype> <connection-address>
@@ -198,9 +198,9 @@ typedef struct {
198198

199199
SdpMediaDescription mediaDescriptions[MAX_SDP_SESSION_MEDIA_COUNT];
200200

201-
UINT8 sessionAttributesCount;
201+
UINT16 sessionAttributesCount;
202202

203-
UINT8 mediaCount;
203+
UINT16 mediaCount;
204204

205205
UINT8 timezoneCount;
206206

tst/SdpApiTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ s=-
232232
t=0 0
233233
)";
234234

235-
for (auto i = 0; i < 250; i++) {
235+
for (auto i = 0; i <= MAX_SDP_ATTRIBUTES_COUNT + 1; i++) {
236236
sessionDescriptionNoMedia += "a=b\n";
237237
}
238238

0 commit comments

Comments
 (0)