summaryrefslogtreecommitdiff
path: root/libavcodec/bintext.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-09-12 02:11:00 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-09-28 01:33:42 +0200
commit8db9097308dcc72f3f1f459a2b39f7a987ddd978 (patch)
tree82f1d92100653c31212de13a11da0623fc668430 /libavcodec/bintext.c
parent35517e3ca7ea2e243e3e29ec7d4d2a9f150f25ed (diff)
downloadffmpeg-8db9097308dcc72f3f1f459a2b39f7a987ddd978.tar.gz
avcodec/bintext: Check input size before allocating the input image
Fixes: Timeout Fixes: 9795/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XBIN_fuzzer-5768631928487936 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/bintext.c')
-rw-r--r--libavcodec/bintext.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c
index d967317671..b14a2a9c29 100644
--- a/libavcodec/bintext.c
+++ b/libavcodec/bintext.c
@@ -146,6 +146,9 @@ static int decode_frame(AVCodecContext *avctx,
const uint8_t *buf_end = buf+buf_size;
int ret;
+ if ((avctx->width / FONT_WIDTH) * (avctx->height / s->font_height) / 256 > buf_size)
+ return AVERROR_INVALIDDATA;
+
s->x = s->y = 0;
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
return ret;