File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
src/Likely Bugs/Memory Management
test/query-tests/Likely Bugs/Memory Management/SuspiciousCallToMemset Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,13 @@ Type stripType(Type t) {
4141 result = stripType ( t .( ArrayType ) .getBaseType ( ) ) or
4242 result = stripType ( t .( ReferenceType ) .getBaseType ( ) ) or
4343 result = stripType ( t .( SpecifiedType ) .getBaseType ( ) ) or
44+ result = stripType ( t .( Decltype ) .getBaseType ( ) ) or
4445 (
4546 not t instanceof TypedefType and
4647 not t instanceof ArrayType and
4748 not t instanceof ReferenceType and
4849 not t instanceof SpecifiedType and
50+ not t instanceof Decltype and
4951 result = t
5052 )
5153}
Original file line number Diff line number Diff line change @@ -171,3 +171,10 @@ void more_tests_2()
171171 memset (iapa, 0 , sizeof (iapa)); // GOOD
172172 memset (iapa, 0 , sizeof (intArrayPointer *)); // BAD
173173}
174+
175+ void more_tests_3 ()
176+ {
177+ myStruct ms;
178+ decltype (&ms) msPtr = &ms;
179+ memset (msPtr, 0 , sizeof (myStruct)); // GOOD
180+ }
You can’t perform that action at this time.
0 commit comments