Skip to content

Commit 3d9689a

Browse files
committed
CID 909355: TAINTED_SCALAR
1 parent 7b475cb commit 3d9689a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

plugins/protocol_lws_webrtc_mixer/mixer-media.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,10 @@ process_session_media(struct mixer_media_session *s)
548548
size_t in_len = msg->len;
549549
int ready_to_decode = 1;
550550

551+
/* satisfy coverity */
552+
if (in_len > 16 * 1024 * 1024)
553+
in_len = 0;
554+
551555
if (msg->codec == LWS_CODEC_H264 && in_data && in_len > 0) {
552556
ready_to_decode = 0;
553557
uint8_t header = in_data[0];
@@ -577,8 +581,8 @@ process_session_media(struct mixer_media_session *s)
577581
while (off + 2 <= in_len) {
578582
uint16_t nal_size = (uint16_t)((in_data[off] << 8) | in_data[off+1]);
579583
off += 2;
580-
if (nal_size == 0) {
581-
lwsl_err("%s: H264 Parse Error: 0-length NAL in STAP-A detected, breaking loop\n", __func__);
584+
if (nal_size == 0 || nal_size > 65000) {
585+
lwsl_err("%s: H264 Parse Error: invalid NAL size %u in STAP-A detected, breaking loop\n", __func__, nal_size);
582586
break;
583587
}
584588
if (off + nal_size > in_len) break;

0 commit comments

Comments
 (0)