Workaround crash with AMI addressDiff calculation

references #219
This commit is contained in:
vit9696 2020-09-25 18:16:10 +03:00
parent a2d7169a82
commit b96772190a

View File

@ -3453,6 +3453,7 @@ USTATUS FfsParser::checkProtectedRanges(const UModelIndex & index)
&& bgProtectedRanges[i].Size != 0 && bgProtectedRanges[i].Size != 0xFFFFFFFF
&& bgProtectedRanges[i].Offset != 0 && bgProtectedRanges[i].Offset != 0xFFFFFFFF) {
if ((UINT64)bgProtectedRanges[i].Offset >= addressDiff) {
bgProtectedRanges[i].Offset -= (UINT32)addressDiff;
protectedParts = openedImage.mid(bgProtectedRanges[i].Offset, bgProtectedRanges[i].Size);
@ -3466,6 +3467,10 @@ USTATUS FfsParser::checkProtectedRanges(const UModelIndex & index)
}
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
} else {
// TODO: Explore this.
msg(usprintf("%s: Suspicious AMI new BG protection offset", __FUNCTION__), index);
}
}
else if (bgProtectedRanges[i].Type == BG_PROTECTED_RANGE_VENDOR_HASH_PHOENIX
&& bgProtectedRanges[i].Size != 0 && bgProtectedRanges[i].Size != 0xFFFFFFFF