diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-09 20:47:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-09 21:06:01 +0100 |
commit | b8551f8ea71b7d6ae39de121213860262d911001 (patch) | |
tree | 792541075cf61de80cf87cd95c45c3d1b4f02cbb /libavcodec | |
parent | ac7ff0963bf353ffd951ae8d51444b82b7ea69c1 (diff) | |
download | ffmpeg-b8551f8ea71b7d6ae39de121213860262d911001.tar.gz |
pcmdec: check that channels is valid.
Prevents a division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pcm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 85a5fe6ed4..47a55091b3 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -288,6 +288,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, return AVERROR(EINVAL); } + if (avctx->channels == 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); + return AVERROR(EINVAL); + } + n = avctx->channels * sample_size; if (n && buf_size % n) { |