diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-23 01:20:25 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-23 01:21:25 +0300 |
commit | 2002436b0c914e18eda4f45ef816b14501a1dbae (patch) | |
tree | dbf7521d3f87b2cbe91866fb61cbd586023e6ab6 /libavcodec/xsubdec.c | |
parent | cfd1ecdc0bb039014fbb40b45edb88121bad92f9 (diff) |
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.c | 3 |
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) |