aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-16 15:19:52 +0300
committerLuca Barbato <lu_zero@gentoo.org>2014-01-07 09:43:56 +0100
commit48f27c854f23b43890f72239c5d18b7fff0707af (patch)
tree87aa077132bb61c32b2c744f9eb2e3824712a20d
parent802deb2d136fd2e2b6f445476703c05a0b633aa2 (diff)
downloadffmpeg-48f27c854f23b43890f72239c5d18b7fff0707af.tar.gz
mace: Make sure that the channel count is set to a valid value
Also return a proper error code. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit e1f3847f860a1094a46be4c5f10db8df616c3135) Signed-off-by: Luca Barbato <lu_zero@gentoo.org> Conflicts: libavcodec/mace.c
-rw-r--r--libavcodec/mace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mace.c b/libavcodec/mace.c
index 792d71d072..d02b1dc095 100644
--- a/libavcodec/mace.c
+++ b/libavcodec/mace.c
@@ -231,8 +231,8 @@ static av_cold int mace_decode_init(AVCodecContext * avctx)
{
MACEContext *ctx = avctx->priv_data;
- if (avctx->channels > 2)
- return -1;
+ if (avctx->channels > 2 || avctx->channels < 1)
+ return AVERROR(EINVAL);
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avcodec_get_frame_defaults(&ctx->frame);