aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-11 15:18:50 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-14 12:20:16 +0200
commitb83e839f1e2501af5d58a082a5e8b93359952a01 (patch)
tree9d7722d8b6810117ce06ca733105715d5ed510dc
parentb36be353b8624bef9384943d5f26e4d0b44e6b5d (diff)
downloadffmpeg-b83e839f1e2501af5d58a082a5e8b93359952a01.tar.gz
avcodec/dvbsubdec: Check entry_id
Fixes: randomly writing over the array end Fixes: 1473/clusterfuzz-testcase-minimized-5768907824562176 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 8a69f2602fea04b7ebae2db16f2581e8ff5ee0cd) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dvbsubdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 9e48ab4a25..9525cb7885 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1218,9 +1218,9 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
}
- if (depth & 0x80)
+ if (depth & 0x80 && entry_id < 4)
clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
- else if (depth & 0x40)
+ else if (depth & 0x40 && entry_id < 16)
clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha);
else if (depth & 0x20)
clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha);