mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 902909: Make some content-controlled allocations fallible in IndexedDB. r=sicking
This commit is contained in:
parent
2335177831
commit
9279991419
@ -55,6 +55,8 @@ using namespace mozilla::dom::indexedDB::ipc;
|
|||||||
using mozilla::dom::quota::FileOutputStream;
|
using mozilla::dom::quota::FileOutputStream;
|
||||||
using mozilla::ErrorResult;
|
using mozilla::ErrorResult;
|
||||||
|
|
||||||
|
static const mozilla::fallible_t fallible;
|
||||||
|
|
||||||
BEGIN_INDEXEDDB_NAMESPACE
|
BEGIN_INDEXEDDB_NAMESPACE
|
||||||
|
|
||||||
struct FileHandleData
|
struct FileHandleData
|
||||||
@ -1133,7 +1135,8 @@ IDBObjectStore::GetStructuredCloneReadInfoFromStatement(
|
|||||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoArrayPtr<char> uncompressed(new char[uncompressedLength]);
|
nsAutoArrayPtr<char> uncompressed(new (fallible) char[uncompressedLength]);
|
||||||
|
NS_ENSURE_TRUE(uncompressed, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
if (!snappy::RawUncompress(compressed, compressedLength,
|
if (!snappy::RawUncompress(compressed, compressedLength,
|
||||||
uncompressed.get())) {
|
uncompressed.get())) {
|
||||||
@ -2969,7 +2972,8 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
|||||||
size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength);
|
size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength);
|
||||||
// This will hold our compressed data until the end of the method. The
|
// This will hold our compressed data until the end of the method. The
|
||||||
// BindBlobByName function will copy it.
|
// BindBlobByName function will copy it.
|
||||||
nsAutoArrayPtr<char> compressed(new char[compressedLength]);
|
nsAutoArrayPtr<char> compressed(new (fallible) char[compressedLength]);
|
||||||
|
NS_ENSURE_TRUE(compressed, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
snappy::RawCompress(uncompressed, uncompressedLength, compressed.get(),
|
snappy::RawCompress(uncompressed, uncompressedLength, compressed.get(),
|
||||||
&compressedLength);
|
&compressedLength);
|
||||||
|
@ -30,6 +30,8 @@ using namespace mozilla::dom;
|
|||||||
USING_INDEXEDDB_NAMESPACE
|
USING_INDEXEDDB_NAMESPACE
|
||||||
USING_QUOTA_NAMESPACE
|
USING_QUOTA_NAMESPACE
|
||||||
|
|
||||||
|
static const mozilla::fallible_t fallible;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// If JS_STRUCTURED_CLONE_VERSION changes then we need to update our major
|
// If JS_STRUCTURED_CLONE_VERSION changes then we need to update our major
|
||||||
@ -882,7 +884,8 @@ public:
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength);
|
size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength);
|
||||||
nsAutoArrayPtr<char> compressed(new char[compressedLength]);
|
nsAutoArrayPtr<char> compressed(new (fallible) char[compressedLength]);
|
||||||
|
NS_ENSURE_TRUE(compressed, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
snappy::RawCompress(reinterpret_cast<const char*>(uncompressed),
|
snappy::RawCompress(reinterpret_cast<const char*>(uncompressed),
|
||||||
uncompressedLength, compressed.get(),
|
uncompressedLength, compressed.get(),
|
||||||
|
Loading…
Reference in New Issue
Block a user