[FFmpeg-cvslog] westwood_aud: prevent division by zero

Andreas Cadhalpun git at videolan.org
Mon Oct 17 21:46:44 EEST 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Oct 16 22:42:32 2016 +0200| [bc7e128a6e8e2a79d0ff7cab5e8a799b3ea042ea] | committer: Andreas Cadhalpun

westwood_aud: prevent division by zero

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavformat/westwood_aud.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/westwood_aud.c b/libavformat/westwood_aud.c
index 4750167..9c2d35c 100644
--- a/libavformat/westwood_aud.c
+++ b/libavformat/westwood_aud.c
@@ -164,6 +164,12 @@ static int wsaud_read_packet(AVFormatContext *s,
         if (ret != chunk_size)
             return AVERROR(EIO);
 
+        if (st->codecpar->channels <= 0) {
+            av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n",
+                   st->codecpar->channels);
+            return AVERROR_INVALIDDATA;
+        }
+
         /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
         pkt->duration = (chunk_size * 2) / st->codecpar->channels;
     }



More information about the ffmpeg-cvslog mailing list