diff mbox series

[FFmpeg-devel,5/5] avcodec/ansi: Check initial dimensions

Message ID 20200919193109.31148-5-michael@niedermayer.cc
State Accepted
Commit 949f0a6be974e4083f8e130c2d6870ef26f0eece
Headers show
Series [FFmpeg-devel,1/5] avcodec/sonic: Check for overread
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Sept. 19, 2020, 7:31 p.m. UTC
Fixes: Timeout (minutes to less than 1sec)
Fixes: 25682/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ANSI_fuzzer-6320712032452608

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

Patch

diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 272185230d..3a461eec26 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -475,6 +475,11 @@  static av_cold int decode_close(AVCodecContext *avctx)
     return 0;
 }
 
+static const AVCodecDefault ansi_defaults[] = {
+    { "max_pixels", "640*480" },
+    { NULL },
+};
+
 AVCodec ff_ansi_decoder = {
     .name           = "ansi",
     .long_name      = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"),
@@ -486,4 +491,5 @@  AVCodec ff_ansi_decoder = {
     .decode         = decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .defaults       = ansi_defaults,
 };