diff mbox series

[FFmpeg-devel,3/8] avformat/moflex: Check pkt_size

Message ID 20201024222312.5806-3-michael@niedermayer.cc
State Accepted
Commit 40348637bee613a9123d869acd7be0ce837653ad
Headers show
Series [FFmpeg-devel,1/8] tools/target_dem_fuzzer: Limit max blocks
Related show

Checks

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

Commit Message

Michael Niedermayer Oct. 24, 2020, 10:23 p.m. UTC
Fixes: Timeout (>20sec -> 1ms)
Fixes: 26527/clusterfuzz-testcase-minimized-ffmpeg_dem_MOFLEX_fuzzer-6308307310215168

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

Comments

Michael Niedermayer Nov. 22, 2020, 4:39 p.m. UTC | #1
On Sun, Oct 25, 2020 at 12:23:07AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (>20sec -> 1ms)
> Fixes: 26527/clusterfuzz-testcase-minimized-ffmpeg_dem_MOFLEX_fuzzer-6308307310215168
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/moflex.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/moflex.c b/libavformat/moflex.c
index a24e12eb8e..8142925adc 100644
--- a/libavformat/moflex.c
+++ b/libavformat/moflex.c
@@ -316,6 +316,8 @@  static int moflex_read_packet(AVFormatContext *s, AVPacket *pkt)
             }
 
             pkt_size = pop_int(br, pb, 13) + 1;
+            if (pkt_size > m->size)
+                return AVERROR_INVALIDDATA;
             packet   = s->streams[stream_index]->priv_data;
             if (!packet) {
                 avio_skip(pb, pkt_size);