diff mbox

[FFmpeg-devel,5/5] avcodec/ptx: Check that the input contains at least one line

Message ID 20191002213740.17936-5-michael@niedermayer.cc
State Accepted
Commit a6ad328256fe6a6ace7d1e15f3515afccf1247fc
Headers show

Commit Message

Michael Niedermayer Oct. 2, 2019, 9:37 p.m. UTC
Fixes: Timeout (19sec -> 44ms)
Fixes: 17816/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PTX_fuzzer-5704459950227456

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

Comments

Michael Niedermayer Oct. 20, 2019, 5:23 p.m. UTC | #1
On Wed, Oct 02, 2019 at 11:37:40PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (19sec -> 44ms)
> Fixes: 17816/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PTX_fuzzer-5704459950227456
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ptx.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c
index 42147f4afc..19f9305cda 100644
--- a/libavcodec/ptx.c
+++ b/libavcodec/ptx.c
@@ -55,6 +55,9 @@  static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     buf += offset;
 
+    if (buf_end - buf < w * bytes_per_pixel)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
         return ret;