https://bugs.llvm.org/show_bug.cgi?id=32430
Bug ID: 32430
Summary: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:
PVS-Studio: CWE-476 (NULL Pointer Dereference)
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
We have found a weakness using PVS-Studio tool. PVS-Studio is a static code
analyzer for C, C++ and C#: https://www.viva64.com/en/pvs-studio/
Analyzer warning: V595 The 'DIExpr' pointer was utilized before it was verified
against nullptr. Check lines: 949, 950. codeviewdebug.cpp 949
void CodeViewDebug::collectVariableInfo(const DISubprogram *SP) {
....
const DIExpression *DIExpr = DVInst->getDebugExpression();
bool IsSubfield = false;
unsigned StructOffset = 0;
// Handle fragments.
auto Fragment = DIExpr->getFragmentInfo(); // <=
if (DIExpr && Fragment) { // <=
IsSubfield = true;
StructOffset = Fragment->OffsetInBits / 8;
} else if (DIExpr && DIExpr->getNumElements() > 0) {
continue; // Ignore unrecognized exprs.
}
....
}
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs