Backed out changeset 51994c27948c (bug 1197280) for test_eme_non_mse_fails.html failures CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Wed, 16 Sep 2015 14:39:03 -0700
changeset 295477 62983bc471ac793c5ef7eda319463ad0d7b32c1e
parent 295476 b4f94fa3627dd5dc02cc1bf68345e51176e06c97
child 295478 19fcb3464e7d61fda4f20d2e372d3577055b2011
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1197280
milestone43.0a1
backs out51994c27948c7255ae448d126a53a6308fa14ab0
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 51994c27948c (bug 1197280) for test_eme_non_mse_fails.html failures CLOSED TREE
media/libstagefright/system/core/libutils/SharedBuffer.cpp
--- a/media/libstagefright/system/core/libutils/SharedBuffer.cpp
+++ b/media/libstagefright/system/core/libutils/SharedBuffer.cpp
@@ -12,33 +12,26 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #include <stdlib.h>
 #include <string.h>
 
-#include <mozilla/CheckedInt.h>
 #include <utils/SharedBuffer.h>
 #include <utils/Atomic.h>
 
 // ---------------------------------------------------------------------------
 
 namespace stagefright {
 
 SharedBuffer* SharedBuffer::alloc(size_t size)
 {
-    mozilla::CheckedInt<size_t> allocSize = size;
-    allocSize += sizeof(SharedBuffer);
-    if (!allocSize.isValid() || allocSize.value() >= SIZE_MAX) {
-        return nullptr;
-    }
-
-    SharedBuffer* sb = static_cast<SharedBuffer*>(malloc(allocSize.value()));
+    SharedBuffer* sb = static_cast<SharedBuffer *>(malloc(sizeof(SharedBuffer) + size));
     if (sb) {
         sb->mRefs = 1;
         sb->mSize = size;
     }
     return sb;
 }
 
 
@@ -62,27 +55,21 @@ SharedBuffer* SharedBuffer::edit() const
     return sb;    
 }
 
 SharedBuffer* SharedBuffer::editResize(size_t newSize) const
 {
     if (onlyOwner()) {
         SharedBuffer* buf = const_cast<SharedBuffer*>(this);
         if (buf->mSize == newSize) return buf;
-        mozilla::CheckedInt<size_t> reallocSize = newSize;
-        reallocSize += sizeof(SharedBuffer);
-        if (reallocSize.isValid() && reallocSize.value() < SIZE_MAX) {
-          buf = (SharedBuffer*)realloc(buf, reallocSize.value());
-          if (buf != nullptr) {
-            buf->mSize = reallocSize.value();
+        buf = (SharedBuffer*)realloc(buf, sizeof(SharedBuffer) + newSize);
+        if (buf != NULL) {
+            buf->mSize = newSize;
             return buf;
-          }
         }
-        // Overflow or allocation failed.
-        return nullptr;
     }
     SharedBuffer* sb = alloc(newSize);
     if (sb) {
         const size_t mySize = mSize;
         memcpy(sb->data(), data(), newSize < mySize ? newSize : mySize);
         release();
     }
     return sb;