[FFmpeg-cvslog] interplayacm: validate number of channels

Andreas Cadhalpun git at videolan.org
Sun Nov 27 01:41:07 EET 2016


ffmpeg | branch: release/3.0 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Oct 30 21:41:11 2016 +0100| [aa32d415275613e406a43d8f091d6981e4e1b872] | committer: Andreas Cadhalpun

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 at gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit 5540d6c1343e6d1e06d6601b7d35884761711e3e)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa32d415275613e406a43d8f091d6981e4e1b872
---

 libavcodec/interplayacm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c
index 2c23fac..14cad09 100644
--- a/libavcodec/interplayacm.c
+++ b/libavcodec/interplayacm.c
@@ -61,6 +61,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;



More information about the ffmpeg-cvslog mailing list