Checkers:UNINIT.STACK.MIGHT
From current
Reference > C/C++ checkers > UNINIT.STACK.MIGHT
This error indicates that a local variable is read and there might be 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 int foo(int t) { 2 int x; 3 if (t > 16) { 4 x = 1; 5 } else if (t > 8) { 6 x = 2; 7 } 8 return x + 1; 9 }
Klocwork produces an uninitialized local variable reading report, indicating that the value of variable 'x' can be used at line 8, when it might be uninitialized.
Related checkers
- UNINIT.STACK.MIGHT
- UNINIT.STACK.MUST


