avformat/rdt: Check pkt_len

Fixes: CID1473553 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Michael Niedermayer 2024-06-07 01:50:00 +02:00 committed by Paul B Mahol
parent 60f46abaa5
commit a2e5bcedb2

View File

@ -206,6 +206,8 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
return -1; /* not followed by a data packet */
pkt_len = AV_RB16(buf+3);
if (pkt_len > len)
return AVERROR_INVALIDDATA;
buf += pkt_len;
len -= pkt_len;
consumed += pkt_len;