[FFmpeg-cvslog] avcodec/dvdsubdec: Sanity check len in decode_rle()
Michael Niedermayer
git at videolan.org
Tue Nov 20 18:39:56 EET 2018
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep 13 03:33:50 2018 +0200| [c2f02af6968498b482d12cc27d0c91891c444a0a] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit e7b023e1db9fb13175929c02a02846d03510ec91)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2f02af6968498b482d12cc27d0c91891c444a0a
---
libavcodec/dvdsubdec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index d017e771fc..4bdffeb700 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;
More information about the ffmpeg-cvslog
mailing list