diff mbox series

[FFmpeg-devel] avformat/rpl: Check for EOF and zero framesize

Message ID 20210605143142.18125-1-michael@niedermayer.cc
State Accepted
Commit a0a4a527c3b0819368d9b148542bb7663f39df79
Headers show
Series [FFmpeg-devel] avformat/rpl: Check for EOF and zero framesize | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer June 5, 2021, 2:31 p.m. UTC
Fixes: Infinite loop
Fixes: 34751/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-5439330800762880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/rpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer June 8, 2021, 3:52 p.m. UTC | #1
On Sat, Jun 05, 2021 at 04:31:42PM +0200, Michael Niedermayer wrote:
> Fixes: Infinite loop
> Fixes: 34751/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-5439330800762880
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/rpl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index de32490fbe..fac377b68e 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -339,7 +339,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);