Location
File: cpp/ManagerBase.cpp:571
Function: ManagerBase::createDvOrder()
Issue
The variable depTable may be used uninitialized if no dependent relation is found.
Code
Table *depTable;
for (k = 0; k < bottomRef->getRelationCount(); ++k) {
if (!bottomRef->getRelation(k)->isIndependentOnly()) {
depTable = bottomRef->getRelation(k)->getTable();
break;
}
}
// If loop completes without finding a dependent relation, depTable is uninitialized
for (k = 0; k < depTable->getTupleCount(); ++k) { // Line 579: potential crash
Risk
High - Will crash with null pointer dereference if no dependent relations exist in the model.
Recommended Fix
Table *depTable = nullptr;
for (k = 0; k < bottomRef->getRelationCount(); ++k) {
if (!bottomRef->getRelation(k)->isIndependentOnly()) {
depTable = bottomRef->getRelation(k)->getTable();
break;
}
}
if (depTable == nullptr) {
fprintf(stderr, "Error: No dependent relation found\n");
return;
}
Reference
See docs/compiler-warning-analysis.md for detailed analysis.
Priority: High
Type: Bug - Potential Crash
Location
File:
cpp/ManagerBase.cpp:571Function:
ManagerBase::createDvOrder()Issue
The variable
depTablemay be used uninitialized if no dependent relation is found.Code
Risk
High - Will crash with null pointer dereference if no dependent relations exist in the model.
Recommended Fix
Reference
See
docs/compiler-warning-analysis.mdfor detailed analysis.Priority: High
Type: Bug - Potential Crash