aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-09 20:47:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-09 21:06:01 +0100
commitb8551f8ea71b7d6ae39de121213860262d911001 (patch)
tree792541075cf61de80cf87cd95c45c3d1b4f02cbb /libavcodec
parentac7ff0963bf353ffd951ae8d51444b82b7ea69c1 (diff)
downloadffmpeg-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.c5
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) {