Browse Source

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 e7b023e1db)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.2.13
Michael Niedermayer 7 years ago
parent
commit
7bcc4d7ea7
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      libavcodec/dvdsubdec.c

+ 2
- 0
libavcodec/dvdsubdec.c View File

@@ -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;


Loading…
Cancel
Save