[FFmpeg-cvslog] avformat/dsfdec: check if number of channels is <= 0

Paul B Mahol git at videolan.org
Sat Apr 30 17:52:27 CEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Apr 30 17:50:22 2016 +0200| [d171cd076f611b70a9d2e08bc261b470affcb932] | committer: Paul B Mahol

avformat/dsfdec: check if number of channels is <= 0

Fixes FPE bellow.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavformat/dsfdec.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c
index beb2fbf..a8c78e4 100644
--- a/libavformat/dsfdec.c
+++ b/libavformat/dsfdec.c
@@ -107,6 +107,9 @@ static int dsf_read_header(AVFormatContext *s)
     st->codecpar->channels     = avio_rl32(pb);
     st->codecpar->sample_rate  = avio_rl32(pb) / 8;
 
+    if (st->codecpar->channels <= 0)
+        return AVERROR_INVALIDDATA;
+
     switch(avio_rl32(pb)) {
     case 1: st->codecpar->codec_id = AV_CODEC_ID_DSD_LSBF_PLANAR; break;
     case 8: st->codecpar->codec_id = AV_CODEC_ID_DSD_MSBF_PLANAR; break;



More information about the ffmpeg-cvslog mailing list