[FFmpeg-cvslog] rl2: Avoid a division by zero

Martin Storsjö git at videolan.org
Fri Sep 20 15:05:53 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Sep 19 16:57:47 2013 +0300| [3ca14aa5964ea5d11f7a15f9fff17924d6096d44] | committer: Martin Storsjö

rl2: Avoid a division by zero

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/rl2.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index ac0532f..ab33aab 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -107,6 +107,10 @@ static av_cold int rl2_read_header(AVFormatContext *s)
     rate = avio_rl16(pb);
     channels = avio_rl16(pb);
     def_sound_size = avio_rl16(pb);
+    if (!channels || channels > 42) {
+        av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", channels);
+        return AVERROR_INVALIDDATA;
+    }
 
     /** setup video stream */
     st = avformat_new_stream(s, NULL);



More information about the ffmpeg-cvslog mailing list