aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-02 10:54:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-10 16:04:26 +0200
commit182a1902f7d813d9797ddd80009be2a27e470fac (patch)
treefe7082514b0ba6a17f9e7444ccd3977e8edb75c1
parentb77c294c9acc90cd26650ccdbaaf08db40c7d36a (diff)
downloadffmpeg-182a1902f7d813d9797ddd80009be2a27e470fac.tar.gz
avcodec/smacker: Check remaining bits in SMK_BLK_FULL
Fixes: out of array access Fixes: 26047/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5083031667474432 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 42ded4d1e6fb0086a235dc584118414ae2bf30c9) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/smacker.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index e9810b1be7..b42d71b1c0 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -484,6 +484,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case SMK_BLK_FULL:
mode = 0;
if(avctx->codec_tag == MKTAG('S', 'M', 'K', '4')) { // In case of Smacker v4 we have three modes
+ if (get_bits_left(&gb) < 1)
+ return AVERROR_INVALIDDATA;
if(get_bits1(&gb)) mode = 1;
else if(get_bits1(&gb)) mode = 2;
}