Hi

The attached patch fixes a possibility for movenc.c to SIGFPE if trackDuration is zero when writing esds. This can happen if the user manages to mux a single AAC packet with dts = 0 and duration = 0.

/Tomas
>From 7dbf9ac26ca677fc664a4569601bb0204e8410be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <tomas.har...@codemill.se>
Date: Wed, 11 May 2011 09:47:50 +0200
Subject: [PATCH] Avoid divide by zero in compute_avg_bitrate()

This can happen if muxing a single AAC packet with duration = 0
---
 libavformat/movenc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a3d470a..d950664 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -261,6 +261,10 @@ static unsigned compute_avg_bitrate(MOVTrack *track)
 {
     uint64_t size = 0;
     int i;
+
+    if (!track->trackDuration)
+        return 0;
+
     for (i = 0; i < track->entry; i++)
         size += track->cluster[i].size;
     return size * 8 * track->timescale / track->trackDuration;
-- 
1.7.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-de...@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to