mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 442012 - Allocating more than 2GB of memory in mozilla is never a good idea. On 64-bit systems PRSize and size_t are 64-bit and so truncation from PRSize to PRUint32 could cause weird behavior errors. Prevent these huge allocations. r=wtc sr=dveditz
This commit is contained in:
parent
92e9d4714f
commit
0c8ea59022
@ -293,6 +293,9 @@ nsMemoryImpl::sFlushEvent;
|
||||
XPCOM_API(void*)
|
||||
NS_Alloc(PRSize size)
|
||||
{
|
||||
if (size > PR_INT32_MAX)
|
||||
return nsnull;
|
||||
|
||||
void* result = MALLOC1(size);
|
||||
if (! result) {
|
||||
// Request an asynchronous flush
|
||||
@ -304,6 +307,9 @@ NS_Alloc(PRSize size)
|
||||
XPCOM_API(void*)
|
||||
NS_Realloc(void* ptr, PRSize size)
|
||||
{
|
||||
if (size > PR_INT32_MAX)
|
||||
return nsnull;
|
||||
|
||||
void* result = REALLOC1(ptr, size);
|
||||
if (! result && size != 0) {
|
||||
// Request an asynchronous flush
|
||||
|
Loading…
Reference in New Issue
Block a user