mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
Provide workaround for #196
This commit is contained in:
parent
fc2d8f07b1
commit
cd110eafa6
@ -3360,13 +3360,22 @@ USTATUS FfsParser::checkProtectedRanges(const UModelIndex & index)
|
|||||||
// Calculate digest for BG-protected ranges
|
// Calculate digest for BG-protected ranges
|
||||||
UByteArray protectedParts;
|
UByteArray protectedParts;
|
||||||
bool bgProtectedRangeFound = false;
|
bool bgProtectedRangeFound = false;
|
||||||
for (UINT32 i = 0; i < (UINT32)bgProtectedRanges.size(); i++) {
|
try {
|
||||||
if (bgProtectedRanges[i].Type == BG_PROTECTED_RANGE_INTEL_BOOT_GUARD_IBB) {
|
for (UINT32 i = 0; i < (UINT32)bgProtectedRanges.size(); i++) {
|
||||||
bgProtectedRangeFound = true;
|
if (bgProtectedRanges[i].Type == BG_PROTECTED_RANGE_INTEL_BOOT_GUARD_IBB && bgProtectedRanges[i].Size > 0) {
|
||||||
bgProtectedRanges[i].Offset -= (UINT32)addressDiff;
|
bgProtectedRangeFound = true;
|
||||||
protectedParts += openedImage.mid(bgProtectedRanges[i].Offset, bgProtectedRanges[i].Size);
|
if ((UINT64)bgProtectedRanges[i].Offset >= addressDiff) {
|
||||||
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
|
bgProtectedRanges[i].Offset -= (UINT32)addressDiff;
|
||||||
|
} else {
|
||||||
|
// TODO: Explore this.
|
||||||
|
msg(usprintf("%s: Suspicious BG protection offset", __FUNCTION__), index);
|
||||||
|
}
|
||||||
|
protectedParts += openedImage.mid(bgProtectedRanges[i].Offset, bgProtectedRanges[i].Size);
|
||||||
|
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (...) {
|
||||||
|
bgProtectedRangeFound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bgProtectedRangeFound) {
|
if (bgProtectedRangeFound) {
|
||||||
|
Loading…
Reference in New Issue
Block a user