aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/interplayacm.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-10-30 21:41:11 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-10-30 22:38:23 +0100
commit5540d6c1343e6d1e06d6601b7d35884761711e3e (patch)
tree0f33bc3c7dc53e25a695395ee6628bc309e21cb4 /libavcodec/interplayacm.c
parent14e4e26559697cfdea584767be4e68474a0a9c7f (diff)
downloadffmpeg-5540d6c1343e6d1e06d6601b7d35884761711e3e.tar.gz
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>
Diffstat (limited to 'libavcodec/interplayacm.c')
-rw-r--r--libavcodec/interplayacm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c
index 0486e00b1e..032053103a 100644
--- a/libavcodec/interplayacm.c
+++ b/libavcodec/interplayacm.c
@@ -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;