aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-09-13 03:33:50 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-10-07 21:34:00 +0200
commit1a05e6ced3dcc371febde26f494f6c5a6ff4c141 (patch)
treea97cf592bf1f54b6257098b3b5d7f9c6eef87c4e /libavcodec
parent5a4234de5eb3f4608f4b4f42cb6da1a0e2c00c85 (diff)
downloadffmpeg-1a05e6ced3dcc371febde26f494f6c5a6ff4c141.tar.gz
avcodec/dvdsubdec: Sanity check len in decode_rle()
Fixes: Timeout Fixes: 9778/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVDSUB_fuzzer-5186007132536832 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 e7b023e1db9fb13175929c02a02846d03510ec91) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dvdsubdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index a5107096df..cf10844753 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -124,6 +124,8 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
len = decode_run_8bit(&gb, &color);
else
len = decode_run_2bit(&gb, &color);
+ if (len != INT_MAX && len > w - x)
+ return AVERROR_INVALIDDATA;
len = FFMIN(len, w - x);
memset(d + x, color, len);
x += len;