mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
BaseTools/VfrCompile: Add check to avoid using NULL pointer
Question value are stored in one specified storage, but the Data type of the storage is not specified or there is no sub fields in the Data type sometimes, so we need to add check before using related pointers. Here list some NULL cases: (1)For an efivastore which doesn't specify a data structure or a data type(UINT8,UINT16...)as the storage, just has VarName and VarSize instead, we can not get its data type before parsing its VarSize. (2)For efivastore which just specifies the data type(UINT8,UINT16...) not a structure as the storage,this data type doesn't have sub-fields. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
2f57de0ae1
commit
631ffb70eb
@ -615,9 +615,13 @@ CVfrVarDataTypeDB::DataTypeHasBitField (
|
||||
SVfrDataField *pTmp;
|
||||
|
||||
GetDataType (TypeName, &pType);
|
||||
|
||||
if (pType == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
for (pTmp = pType->mMembers; pTmp!= NULL; pTmp = pTmp->mNext) {
|
||||
if (pTmp->mIsBitField) {
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
@ -648,7 +652,7 @@ CVfrVarDataTypeDB::IsThisBitField (
|
||||
CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS);
|
||||
pType = pField->mFieldType;
|
||||
}
|
||||
if (pField->mIsBitField) {
|
||||
if (pField != NULL && pField->mIsBitField) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user