avformat/movenc: assert that get_cluster_duration() value is valid
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 21 Feb 2014 01:15:58 +0000 (02:15 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 21 Feb 2014 03:41:21 +0000 (04:41 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/movenc.c

index bb4d379..af7efc9 100644 (file)
@@ -614,7 +614,12 @@ static int get_cluster_duration(MOVTrack *track, int cluster_idx)
     else
         next_dts = track->cluster[cluster_idx + 1].dts;
 
-    return next_dts - track->cluster[cluster_idx].dts;
+    next_dts -= track->cluster[cluster_idx].dts;
+
+    av_assert0(next_dts >= 0);
+    av_assert0(next_dts <= INT_MAX);
+
+    return next_dts;
 }
 
 static int get_samples_per_packet(MOVTrack *track)