r3d: fix division by 0 with 0 sample rate
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 29 Jan 2013 15:57:22 +0000 (16:57 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 29 Jan 2013 15:57:50 +0000 (16:57 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/r3d.c

index 35da81e..5ee0b93 100644 (file)
@@ -312,7 +312,8 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
 
     pkt->stream_index = 1;
     pkt->dts = dts;
-    pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);
+    if (st->codec->sample_rate)
+        pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);
     av_dlog(s, "pkt dts %"PRId64" duration %d samples %d sample rate %d\n",
             pkt->dts, pkt->duration, samples, st->codec->sample_rate);