summaryrefslogtreecommitdiffstats
path: root/contrib/mp4v2/A01-divide-zero.patch
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-01-05 19:06:31 +0000
committerRodeo <[email protected]>2012-01-05 19:06:31 +0000
commit51f487e6f8ba5abfff1429783ade91c0bb92bee0 (patch)
tree8e54e34c5aa5b715124a1c8cbd58467d65a3d275 /contrib/mp4v2/A01-divide-zero.patch
parentc76a5114cf145f954dbf7ca2938f482a972a44d8 (diff)
Backport mp4v2 SVN revision 473.
Fixes a crash due to a division by zero. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4399 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'contrib/mp4v2/A01-divide-zero.patch')
-rw-r--r--contrib/mp4v2/A01-divide-zero.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/contrib/mp4v2/A01-divide-zero.patch b/contrib/mp4v2/A01-divide-zero.patch
new file mode 100644
index 000000000..4d6aa4d2a
--- /dev/null
+++ b/contrib/mp4v2/A01-divide-zero.patch
@@ -0,0 +1,22 @@
+--- mp4v2-r355/src/mp4track.cpp 2012-01-05 15:44:29.000000000 +0100
++++ mp4v2-r355/src/mp4track.cpp 2012-01-05 15:47:34.000000000 +0100
+@@ -819,13 +819,14 @@
+ (thisSecStart + timeScale) - lastSampleTime;
+ // calculate the duration of the last sample
+ MP4Duration lastSampleDur = sampleTime - lastSampleTime;
+- uint32_t overflow_bytes;
+ // now, calculate the number of bytes we overflowed. Round up.
+- overflow_bytes =
+- ((lastSampleSize * overflow_dur) + (lastSampleDur - 1)) / lastSampleDur;
++ if( lastSampleDur > 0 ) {
++ uint32_t overflow_bytes = 0;
++ overflow_bytes = ((lastSampleSize * overflow_dur) + (lastSampleDur - 1)) / lastSampleDur;
+
+- if (bytesThisSec - overflow_bytes > maxBytesPerSec) {
+- maxBytesPerSec = bytesThisSec - overflow_bytes;
++ if (bytesThisSec - overflow_bytes > maxBytesPerSec) {
++ maxBytesPerSec = bytesThisSec - overflow_bytes;
++ }
+ }
+
+ // now adjust the values for this sample. Remove the bytes