Bug 1114867 - Manually inline RtlSecureZeroMemory in GMPLoader, to ensure it doesn't wipe its own stack while running. r=dmajor

This commit is contained in:
Chris Pearce 2015-01-06 07:36:42 +13:00
Родитель 93923b922e
Коммит 2e9cf595cd
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -156,7 +156,13 @@ GMPLoaderImpl::Load(const char* aLibPath,
return false;
}
assert(top >= bottom);
SecureZeroMemory(bottom, (top - bottom));
// Inline instructions equivalent to RtlSecureZeroMemory().
// We can't just use RtlSecureZeroMemory here directly, as in debug
// builds, RtlSecureZeroMemory() can't be inlined, and the stack
// memory it uses would get wiped by itself running, causing crashes.
for (volatile uint8_t* p = (volatile uint8_t*)bottom; p < top; p++) {
*p = 0;
}
} else
#endif
{