Bug 1389470 - fix for zero size memory leak. r?kinetik draft
authorAlfredo.Yang <ayang@mozilla.com>
Thu, 14 Sep 2017 10:29:43 +0800
changeset 664557 9148ef1f8195f23bbcdbd4ce4a62a85a5e1c00e8
parent 663585 0716488dacce15de906f59557c437a3c8dc82216
child 731469 d75d30f1c67b308e89de37e300b039d8a8770fdb
push id79722
push userbmo:ayang@mozilla.com
push dateThu, 14 Sep 2017 02:32:13 +0000
reviewerskinetik
bugs1389470
milestone57.0a1
Bug 1389470 - fix for zero size memory leak. r?kinetik MozReview-Commit-ID: F1hBnukiwKN
media/libstagefright/binding/mp4parse_fallible/lib.rs
media/libstagefright/binding/update-rust.sh
--- a/media/libstagefright/binding/mp4parse_fallible/lib.rs
+++ b/media/libstagefright/binding/mp4parse_fallible/lib.rs
@@ -50,17 +50,17 @@ impl<T> FallibleVec<T> for Vec<T> {
 #[inline(never)]
 #[cold]
 fn try_extend_vec<T>(vec: &mut Vec<T>, new_cap: usize) -> Result<(), ()> {
     let old_ptr = vec.as_mut_ptr();
     let old_len = vec.len();
 
     let old_cap: usize = vec.capacity();
 
-    if old_cap > new_cap {
+    if old_cap >= new_cap {
         return Ok(());
     }
 
     let new_size_bytes
         = new_cap.checked_mul(mem::size_of::<T>()).ok_or(()) ? ;
 
     let new_ptr = unsafe {
         if old_cap == 0 {
--- a/media/libstagefright/binding/update-rust.sh
+++ b/media/libstagefright/binding/update-rust.sh
@@ -1,13 +1,13 @@
 #!/bin/sh -e
 # Script to update mp4parse-rust sources to latest upstream
 
 # Default version.
-VER=759cf90957b1fd5a01632b1aa90cead16c26d0db
+VER=295fd9fac60f1c0627750695a4218e32425b0f66
 
 # Accept version or commit from the command line.
 if test -n "$1"; then
   VER=$1
 fi
 
 echo "Fetching sources..."
 rm -rf _upstream