Browse Source

interplayacm: validate number of channels

The number of channels is used as divisor in decode_frame, so it must
not be zero to avoid SIGFPE crashes.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 5540d6c134)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
tags/n3.2.1
Andreas Cadhalpun 9 years ago
parent
commit
266cf258cc
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavcodec/interplayacm.c

+ 5
- 0
libavcodec/interplayacm.c View File

@@ -62,6 +62,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (avctx->extradata_size < 14)
return AVERROR_INVALIDDATA;

if (avctx->channels <= 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->channels);
return AVERROR_INVALIDDATA;
}

s->level = AV_RL16(avctx->extradata + 12) & 0xf;
s->rows = AV_RL16(avctx->extradata + 12) >> 4;
s->cols = 1 << s->level;


Loading…
Cancel
Save