Skip to content

Commit

Permalink
new Chrome v98 produces extra sdp attributes, up the limit so we do n… (
Browse files Browse the repository at this point in the history
#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>
  • Loading branch information
disa6302 and hassanctech committed Feb 8, 2022
1 parent 22c9e3d commit 111c253
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/source/PeerConnection/SessionDescription.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ STATUS setPayloadTypesFromOffer(PHashTable codecTable, PHashTable rtxTable, PSes
ENTERS();
STATUS retStatus = STATUS_SUCCESS;
PSdpMediaDescription pMediaDescription = NULL;
UINT8 currentMedia, currentAttribute;
UINT8 currentAttribute;
UINT16 currentMedia;
PCHAR attributeValue, end;
UINT64 parsedPayloadType, hashmapPayloadType, fmtpVal, aptVal;
UINT16 aptFmtpVals[MAX_SDP_FMTP_VALUES];
Expand Down
3 changes: 1 addition & 2 deletions src/source/Sdp/Deserialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ STATUS parseMediaName(PSessionDescription pSessionDescription, PCHAR pch, UINT32
{
ENTERS();
STATUS retStatus = STATUS_SUCCESS;

CHK(pSessionDescription->mediaCount < MAX_SDP_SESSION_MEDIA_COUNT, STATUS_BUFFER_TOO_SMALL);

STRNCPY(pSessionDescription->mediaDescriptions[pSessionDescription->mediaCount].mediaName, (pch + SDP_ATTRIBUTE_LENGTH),
Expand Down Expand Up @@ -48,7 +47,7 @@ STATUS parseMediaAttributes(PSessionDescription pSessionDescription, PCHAR pch,
ENTERS();
STATUS retStatus = STATUS_SUCCESS;
PCHAR search;
UINT8 currentMediaAttributesCount;
UINT16 currentMediaAttributesCount;

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

Expand Down
6 changes: 3 additions & 3 deletions src/source/Sdp/Sdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern "C" {
#define MAX_SDP_SESSION_MEDIA_COUNT 5
#define MAX_SDP_MEDIA_BANDWIDTH_COUNT 2

#define MAX_SDP_ATTRIBUTES_COUNT 128
#define MAX_SDP_ATTRIBUTES_COUNT 256

/*
* c=<nettype> <addrtype> <connection-address>
Expand Down Expand Up @@ -198,9 +198,9 @@ typedef struct {

SdpMediaDescription mediaDescriptions[MAX_SDP_SESSION_MEDIA_COUNT];

UINT8 sessionAttributesCount;
UINT16 sessionAttributesCount;

UINT8 mediaCount;
UINT16 mediaCount;

UINT8 timezoneCount;

Expand Down
2 changes: 1 addition & 1 deletion tst/SdpApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ s=-
t=0 0
)";

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

Expand Down

0 comments on commit 111c253

Please sign in to comment.