Verification; assume non-const pointer argument might point at uninitialized data
This commit is contained in:
parent
10010eba95
commit
446256a503
|
@ -1649,9 +1649,12 @@ static ExprEngine::ValuePtr createVariableValue(const Variable &var, Data &data)
|
||||||
else {
|
else {
|
||||||
ValueType vt(*valueType);
|
ValueType vt(*valueType);
|
||||||
vt.pointer = 0;
|
vt.pointer = 0;
|
||||||
pointerValue = getValueRangeFromValueType(data.getNewSymbolName(), &vt, *data.settings);
|
if (vt.constness & 1)
|
||||||
|
pointerValue = getValueRangeFromValueType(data.getNewSymbolName(), &vt, *data.settings);
|
||||||
|
else
|
||||||
|
pointerValue = std::make_shared<ExprEngine::UninitValue>();
|
||||||
}
|
}
|
||||||
return std::make_shared<ExprEngine::ArrayValue>(data.getNewSymbolName(), bufferSize, pointerValue, true, true, true);
|
return std::make_shared<ExprEngine::ArrayValue>(data.getNewSymbolName(), bufferSize, pointerValue, true, true, var.isLocal() && !var.isStatic());
|
||||||
}
|
}
|
||||||
if (var.isArray())
|
if (var.isArray())
|
||||||
return std::make_shared<ExprEngine::ArrayValue>(&data, &var);
|
return std::make_shared<ExprEngine::ArrayValue>(&data, &var);
|
||||||
|
|
|
@ -61,7 +61,8 @@ def check(tc:str, warning_id:str):
|
||||||
|
|
||||||
|
|
||||||
final_report = ''
|
final_report = ''
|
||||||
final_report += check('C/testcases/CWE369_Divide_by_Zero/s*/*.c', 'verificationDivByZero')
|
#final_report += check('C/testcases/CWE369_Divide_by_Zero/s*/*.c', 'verificationDivByZero')
|
||||||
|
final_report += check('C/testcases/CWE457_Use_of_Uninitialized_Variable/s*/*.c', 'verificationUninit')
|
||||||
|
|
||||||
print(final_report)
|
print(final_report)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue