diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-16 15:19:52 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-17 11:21:46 +0300 |
commit | e1f3847f860a1094a46be4c5f10db8df616c3135 (patch) | |
tree | c16f8a250b48bc84e4cc879f5ed5fc50b29dcdfa /libavcodec/mace.c | |
parent | 1115689d54ea95a084421f5a182b8dc56cbff978 (diff) | |
download | ffmpeg-e1f3847f860a1094a46be4c5f10db8df616c3135.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>
Diffstat (limited to 'libavcodec/mace.c')
-rw-r--r-- | libavcodec/mace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 559dcee567..76118e8f2f 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -226,8 +226,8 @@ static void chomp6(ChannelData *chd, int16_t *output, uint8_t val, int tab_idx) static av_cold int mace_decode_init(AVCodecContext * avctx) { - if (avctx->channels > 2) - return -1; + if (avctx->channels > 2 || avctx->channels < 1) + return AVERROR(EINVAL); avctx->sample_fmt = AV_SAMPLE_FMT_S16P; return 0; |