rtsp: fix assertion failure on zero-length RTP payload

Fixes #20735
Reported-by: David Korczynski
Closes #20744
This commit is contained in:
hamza 2026-02-26 16:36:24 +00:00 committed by Daniel Stenberg
parent e86642909f
commit 05d991a8c5
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -774,6 +774,18 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
break;
rtp_buf = curlx_dyn_ptr(&rtspc->buf);
rtspc->rtp_len = RTP_PKT_LENGTH(rtp_buf) + 4;
if(rtspc->rtp_len == 4) {
/* zero-length payload, the 4-byte header is the complete RTP
message. Dispatch immediately without entering RTP_PARSE_DATA. */
DEBUGF(infof(data, "RTP write channel %d rtp_len %zu (no payload)",
rtspc->rtp_channel, rtspc->rtp_len));
result = rtp_client_write(data, rtp_buf, rtspc->rtp_len);
curlx_dyn_free(&rtspc->buf);
rtspc->state = RTP_PARSE_SKIP;
if(result)
goto out;
break;
}
rtspc->state = RTP_PARSE_DATA;
break;
}