avformat/rpl: Check for EOF and zero framesize

Fixes: Infinite loop
Fixes: 34751/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-5439330800762880
Fixes: 34774/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-5851571660390400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a0a4a527c3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-06-03 22:46:05 +02:00
parent 68765c25cd
commit d9c4cfba9f
1 changed files with 1 additions and 1 deletions

View File

@ -324,7 +324,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_skip(pb, 4); /* flags */
frame_size = avio_rl32(pb);
if (avio_seek(pb, -8, SEEK_CUR) < 0)
if (avio_feof(pb) || avio_seek(pb, -8, SEEK_CUR) < 0 || !frame_size)
return AVERROR(EIO);
ret = av_get_packet(pb, pkt, frame_size);