Checkers:UNINIT.STACK.MUST
From current
Reference > C/C++ checkers > UNINIT.STACK.MUST
This error indicates that a local variable of non-class type is read and there is a path in the program where the variable hasn't been initialized.
Vulnerability and risk
Uninitialized variables located in a stack may have garbage data in them. The use of such variables leads to unpredictable behavior.
Example 1
1 struct s { 2 int a; 3 int b; 4 }; 5 6 int main() { 7 struct s x; 8 x.b = 0; 9 return x.a; 10 }
Klocwork produces an uninitialized local variable reading report, indicating that the value of the uninitialized variable 'x.a' is used at line 9.
Related checkers
- UNINIT.STACK.MIGHT
- UNINIT.STACK.MUST


