[FFmpeg-devel] avcodec/clearvideo: Check remaining data in P frames

Submitted by Michael Niedermayer on March 8, 2019, 1:20 a.m.

Details

Message ID 20190308012057.13601-1-michael@niedermayer.cc
State Accepted
Commit 41f93f941155f9f9dbb2d5e7f5d20b2238150836
Headers show

Commit Message

Michael Niedermayer March 8, 2019, 1:20 a.m.
Fixes: Timeout (19sec -> 419msec)
Fixes: 13411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5733153811988480

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

Comments

Michael Niedermayer March 17, 2019, 10:40 a.m.
On Fri, Mar 08, 2019 at 02:20:57AM +0100, Michael Niedermayer wrote:
> Fixes: Timeout (19sec -> 419msec)
> Fixes: 13411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5733153811988480
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/clearvideo.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index ad3012f7b7..82df8f3752 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -555,6 +555,9 @@  static int clv_decode_frame(AVCodecContext *avctx, void *data,
     } else {
         int plane;
 
+        if (c->pmb_width * c->pmb_height > 8LL*(buf_size - bytestream2_tell(&gb)))
+            return AVERROR_INVALIDDATA;
+
         if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
             return ret;