[FFmpeg-cvslog] xwma: Validate channels and bits_per_coded_sample.

Alex Converse git at videolan.org
Thu May 3 00:26:19 CEST 2012


ffmpeg | branch: release/0.10 | Alex Converse <alex.converse at gmail.com> | Wed Mar 21 10:58:07 2012 -0700| [15de658c04b6ce6a6628702837f98b8572e6b9f4] | committer: Reinhard Tartler

xwma: Validate channels and bits_per_coded_sample.

This prevents a SIGFPE later on.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit 5023b89bba198b2f8e43b7f555aeb9c30d33db9f)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavformat/xwma.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 5839bdc..94abfc7 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -115,6 +115,17 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
         }
     }
 
+    if (!st->codec->channels) {
+        av_log(s, AV_LOG_WARNING, "Invalid channel count: %d\n",
+               st->codec->channels);
+        return AVERROR_INVALIDDATA;
+    }
+    if (!st->codec->bits_per_coded_sample) {
+        av_log(s, AV_LOG_WARNING, "Invalid bits_per_coded_sample: %d\n",
+               st->codec->bits_per_coded_sample);
+        return AVERROR_INVALIDDATA;
+    }
+
     /* set the sample rate */
     avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
 



More information about the ffmpeg-cvslog mailing list