mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 51994c27948c (bug 1197280) for test_eme_non_mse_fails.html failures CLOSED TREE
This commit is contained in:
parent
082ef20b76
commit
495adce8fa
@ -17,7 +17,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <mozilla/CheckedInt.h>
|
||||
#include <utils/SharedBuffer.h>
|
||||
#include <utils/Atomic.h>
|
||||
|
||||
@ -27,13 +26,7 @@ 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;
|
||||
@ -67,17 +60,11 @@ 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user