rl2: Avoid a division by zero
authorMartin Storsjö <martin@martin.st>
Thu, 19 Sep 2013 13:57:47 +0000 (16:57 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 19 Sep 2013 19:47:00 +0000 (22:47 +0300)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rl2.c

index ac0532f..ab33aab 100644 (file)
@@ -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);