Module: libav
Branch: release/9
Commit: 9272aa469848cdd6516050e702acac6ecd1ed9cd

Author:    Martin Storsjö <[email protected]>
Committer: Luca Barbato <[email protected]>
Date:      Mon Sep 16 15:19:52 2013 +0300

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: [email protected]
Signed-off-by: Martin Storsjö <[email protected]>
(cherry picked from commit e1f3847f860a1094a46be4c5f10db8df616c3135)
Signed-off-by: Luca Barbato <[email protected]>

Conflicts:
        libavcodec/mace.c

---

 libavcodec/mace.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mace.c b/libavcodec/mace.c
index c78a207..5074e4b 100644
--- a/libavcodec/mace.c
+++ b/libavcodec/mace.c
@@ -229,8 +229,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_S16P;
 
     avcodec_get_frame_defaults(&ctx->frame);

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to