summaryrefslogtreecommitdiff
path: root/libavcodec/xsubdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-23 00:20:25 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-23 00:21:25 +0200
commit2002436b0c914e18eda4f45ef816b14501a1dbae (patch)
treedbf7521d3f87b2cbe91866fb61cbd586023e6ab6 /libavcodec/xsubdec.c
parentcfd1ecdc0bb039014fbb40b45edb88121bad92f9 (diff)
downloadffmpeg-2002436b0c914e18eda4f45ef816b14501a1dbae.tar.gz
avcodec/xsubdec: Check that RLE coded image and colors fit in the buffer
Fixes: Timeout Fixes: 1747/clusterfuzz-testcase-minimized-6035451213250560 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/xsubdec.c')
-rw-r--r--libavcodec/xsubdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index 2a766b33f7..93fd0f4d50 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -91,6 +91,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
// we just ignore it
bytestream_get_le16(&buf);
+ if (buf_end - buf < h + 3*4)
+ return AVERROR_INVALIDDATA;
+
// allocate sub and set values
sub->rects = av_mallocz(sizeof(*sub->rects));
if (!sub->rects)