Skip to content

Commit

Permalink
mace: Make sure that the channel count is set to a valid value
Browse files Browse the repository at this point in the history
Also return a proper error code.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: [email protected]
Signed-off-by: Martin Storsjö <[email protected]>
  • Loading branch information
mstorsjo committed Sep 17, 2013
1 parent 1115689 commit e1f3847
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libavcodec/mace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e1f3847

Please sign in to comment.