diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-15 16:52:08 +0300 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2017-06-01 15:22:01 +0300 |
commit | b98f082d8ddc0a0d8317114d8414ab51de60ef02 (patch) | |
tree | 59a20ce281e5270ea32c63a24f30e5e5c306202c /libavcodec/smacker.c | |
parent | 2ca759657bcda328acc312e5882a940333a3e268 (diff) |
smacker: Check that the data size is a multiple of a sample vector
Fixes out of array access
Fixes: ce19e41f0ef1e52a23edc488faecdb58/asan_heap-oob_2504e97_4202_ffa0df1baed14022b9bfd4f8ac23d0cb.smk
Bug-Id: CVE-2015-8365
CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4a9af07a49295e014b059c1ab624c40345af5892)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/smacker.c')
-rw-r--r-- | libavcodec/smacker.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index c4b4bc735d..d42347ccdc 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -636,6 +636,11 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n"); return AVERROR(EINVAL); } + if (unp_size % (avctx->channels * (bits + 1))) { + av_log(avctx, AV_LOG_ERROR, + "The buffer does not contain an integer number of samples\n"); + return AVERROR(EINVAL); + } /* get output buffer */ frame->nb_samples = unp_size / (avctx->channels * (bits + 1)); |