зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1587112 - Make asserts in StartupCache::LoadArchive explicit r=njn
There is no behavior change here - these asserts were previously being hit inside the operator+ of RangedPtr, but this makes them explicit. Differential Revision: https://phabricator.services.mozilla.com/D49985 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ca34a940cf
Коммит
cc57ad9bcb
|
@ -283,7 +283,8 @@ Result<Ok, nsresult> StartupCache::LoadArchive() {
|
|||
headerSize = LittleEndian::readUint32(data.get());
|
||||
data += sizeof(headerSize);
|
||||
|
||||
if (data + headerSize > end) {
|
||||
if (headerSize > end - data) {
|
||||
MOZ_ASSERT(false, "StartupCache file is corrupt.");
|
||||
return Err(NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
|
@ -312,7 +313,8 @@ Result<Ok, nsresult> StartupCache::LoadArchive() {
|
|||
buf.codeUint32(uncompressedSize);
|
||||
buf.codeString(key);
|
||||
|
||||
if (data + offset + compressedSize > end) {
|
||||
if (offset + compressedSize > end - data) {
|
||||
MOZ_ASSERT(false, "StartupCache file is corrupt.");
|
||||
return Err(NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче