Details
-
Type:
False Negative
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: Subject: Symbolic execution, Importance: Relevant, Level: Medium
-
Component/s: C, C++, Objective-C, Rules
-
Labels:
Description
As soon as a struct has more than two fields, FN appear when the unitialized struct is the return object of a function.
See example here:
struct Person { int id; char* name; }; struct PersonWithAge { int id; int age; char* name; }; Person create_a_person_unint() { Person person; return person; } PersonWithAge create_a_personWithAge_unint() { PersonWithAge person; return person; } int main() { auto pId = create_a_person_unint().id; // OK, issue is raised auto pIdWithAge = create_a_personWithAge_unint().id; // FN PersonWithAge p; pIdWithAge = p.id; // OK, issue is raised return 0; }