[FFmpeg-cvslog] r3d: fix division by 0 with 0 sample rate

Michael Niedermayer git at videolan.org
Tue Jan 29 17:10:34 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan 29 16:57:22 2013 +0100| [df92ac18528bac4566fc4f5ba4d607c1265791ea] | committer: Michael Niedermayer

r3d: fix division by 0 with 0 sample rate

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/r3d.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 35da81e..5ee0b93 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -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);
 



More information about the ffmpeg-cvslog mailing list