mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 01:59:29 +00:00
Bug 1028802 - Don't dereference null pointer in AlignedArray::Rellaoc. r=jwatt
This commit is contained in:
parent
4257cf507f
commit
1df743478e
@ -152,6 +152,12 @@ struct AlignedArray
|
||||
// We don't create an array of T here, since we don't want ctors to be
|
||||
// invoked at the wrong places if we realign below.
|
||||
mStorage = new (std::nothrow) uint8_t[storageByteCount.value()];
|
||||
if (!mStorage) {
|
||||
mStorage = nullptr;
|
||||
mPtr = nullptr;
|
||||
mCount = 0;
|
||||
return;
|
||||
}
|
||||
if (uintptr_t(mStorage) % alignment) {
|
||||
// Our storage does not start at a <alignment>-byte boundary. Make sure mPtr does!
|
||||
mPtr = (T*)(uintptr_t(mStorage) + alignment - (uintptr_t(mStorage) % alignment));
|
||||
|
Loading…
x
Reference in New Issue
Block a user