aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-02-26 21:17:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-18 01:16:03 +0200
commitee33e79b25b878b520277fe7b38a1979e813ed61 (patch)
treee7683754e702f565b0d149595c6e92adbdf0b013
parentae49cc73f265a155e5c4b1715570aab3d9741b4d (diff)
downloadffmpeg-ee33e79b25b878b520277fe7b38a1979e813ed61.tar.gz
avcodec/bintext: sanity check dimensions
Fixes: Timeout Fixes: 6277/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XBIN_fuzzer-6047202288861184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 090c0abff9c8b27304614f15d9464dbf4ea59833) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/bintext.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c
index 90bbe67b59..d967317671 100644
--- a/libavcodec/bintext.c
+++ b/libavcodec/bintext.c
@@ -35,6 +35,8 @@
#include "bintext.h"
#include "internal.h"
+#define FONT_WIDTH 8
+
typedef struct XbinContext {
AVFrame *frame;
int palette[16];
@@ -91,6 +93,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
break;
}
}
+ if (avctx->width < FONT_WIDTH || avctx->height < s->font_height)
+ return AVERROR_INVALIDDATA;
+
s->frame = av_frame_alloc();
if (!s->frame)
@@ -113,8 +118,6 @@ av_unused static void hscroll(AVCodecContext *avctx)
}
}
-#define FONT_WIDTH 8
-
/**
* Draw character to screen
*/