[FFmpeg-devel,6/6] avcodec/vb: Check input packet size to be large enough to contain flags

Submitted by Michael Niedermayer on Aug. 12, 2019, 12:17 a.m.

Details

Message ID 20190812001719.9247-6-michael@niedermayer.cc
State Accepted
Commit dea2591d4fbc989ca82bc8a8ad7d16aacdc89af1
Headers show

Commit Message

Michael Niedermayer Aug. 12, 2019, 12:17 a.m.
Fixes: Timeout (->9sec)
Fixes: 16292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VB_fuzzer-5747063496638464

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

Comments

Michael Niedermayer Aug. 29, 2019, 1:19 p.m.
On Mon, Aug 12, 2019 at 02:17:19AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (->9sec)
> Fixes: 16292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VB_fuzzer-5747063496638464
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vb.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index c6dd6fb456..d9c6b93a73 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -199,6 +199,9 @@  static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     uint32_t size;
     int offset = 0;
 
+    if (avpkt->size < 2)
+        return AVERROR_INVALIDDATA;
+
     bytestream2_init(&c->stream, avpkt->data, avpkt->size);
 
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)