mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
Fix access to undefined SlotCount.
This commit is contained in:
parent
dfbdc8ae45
commit
8b14c24c7c
@ -207,9 +207,17 @@ public:
|
||||
virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override {
|
||||
if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false;
|
||||
XBool b = true;
|
||||
if ( Modules.size() == 0 ) {
|
||||
// whatever if SlotCount is defined or not, and whatever value, it's ok.
|
||||
return b;
|
||||
}
|
||||
if ( !SlotCount.isDefined() ) {
|
||||
xmlLiteParser->addWarning(generateErrors, S8Printf("SlotCount is not defined in SMBIOS, but you defined memory modules. SlotCount adjusted to %d, which maybe wrong.", Modules.dgetCalculatedSlotCount())); // do not set b to false because value is auto-corrected, so it's now ok.
|
||||
SlotCount.setUInt8Value(Modules.dgetCalculatedSlotCount());
|
||||
}else{
|
||||
for ( size_t i = 0 ; i < Modules.size() ; ) {
|
||||
if ( Modules[i].SlotIndex.value() >= SlotCount.value() ) {
|
||||
xmlLiteParser->addWarning(generateErrors, S8Printf("Ignore memory module with slot >= SlotCount at '%s:%d'", xmlPath.c_str(), keyPos.getLine()));
|
||||
xmlLiteParser->addWarning(generateErrors, S8Printf("Ignored memory module with slot >= SlotCount at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); // do not set b to false because value is auto-corrected, so it's now ok.
|
||||
Modules.RemoveAtIndex(i);
|
||||
}else{
|
||||
i++;
|
||||
@ -219,6 +227,7 @@ public:
|
||||
log_technical_bug("SlotCount.value() < Modules.dgetCalculatedSlotCount()");
|
||||
SlotCount.setUInt8Value(Modules.dgetCalculatedSlotCount());
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user