diff mbox

[FFmpeg-devel,2/3] avcodec/eatqi: Check for minimum frame size

Message ID 20190728230931.23214-2-michael@niedermayer.cc
State Accepted
Commit 5ffb8e879389fb0642654e3233cfeca1f9841e52
Headers show

Commit Message

Michael Niedermayer July 28, 2019, 11:09 p.m. UTC
The minimum header is 8 bytes, the smallest bitstream that is passed to
the MB decode code is 4 bytes

Fixes: Timeout (35sec -> 18sec)
Fixes: 15800/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATQI_fuzzer-5684154517159936

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

Comments

Paul B Mahol July 29, 2019, 6:47 a.m. UTC | #1
LGTM

On Mon, Jul 29, 2019 at 1:11 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> The minimum header is 8 bytes, the smallest bitstream that is passed to
> the MB decode code is 4 bytes
>
> Fixes: Timeout (35sec -> 18sec)
> Fixes:
> 15800/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATQI_fuzzer-5684154517159936
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> <https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by>:
> Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/eatqi.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
> index 0002d45457..96536b1a08 100644
> --- a/libavcodec/eatqi.c
> +++ b/libavcodec/eatqi.c
> @@ -131,6 +131,9 @@ static int tqi_decode_frame(AVCodecContext *avctx,
>      AVFrame *frame = data;
>      int ret, w, h;
>
> +    if (buf_size < 12)
> +        return AVERROR_INVALIDDATA;
> +
>      t->avctx = avctx;
>
>      w = AV_RL16(&buf[0]);
> --
> 2.22.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer July 29, 2019, 5:19 p.m. UTC | #2
On Mon, Jul 29, 2019 at 08:47:07AM +0200, Paul B Mahol wrote:
> LGTM

will apply

thanks

[...]
diff mbox

Patch

diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index 0002d45457..96536b1a08 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -131,6 +131,9 @@  static int tqi_decode_frame(AVCodecContext *avctx,
     AVFrame *frame = data;
     int ret, w, h;
 
+    if (buf_size < 12)
+        return AVERROR_INVALIDDATA;
+
     t->avctx = avctx;
 
     w = AV_RL16(&buf[0]);