Skip to content

Commit 676c6b2

Browse files
authored
Merge pull request #313 from microsoft/brodes/nested_sizeof_or_operation_in_sizeof_fix
Minor fix to the query that should not alter prior semantics. Previou…
2 parents c9b45fd + 55a3dae commit 676c6b2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

cpp/ql/src/Microsoft/Likely Bugs/SizeOfMisuse/ArgumentIsSizeofOrOperation.ql

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ predicate isIgnorableBinaryOperation(BinaryOperation op) {
2424
zeroOperand.getExplicitlyConverted().getUnspecifiedType() = t and
2525
// often 'NULL' is defined as (void *)0, ignore these cases
2626
not t instanceof VoidPointerType and
27-
(
28-
// Apparently derived types, eg., functoin pointers, aren't PointerType
29-
// according to codeql, so special casing them out here.
30-
other.getUnspecifiedType() instanceof DerivedType
31-
or
32-
other.getUnspecifiedType() instanceof PointerType
33-
)
27+
// Note Function pointers are not considered PointerType
28+
// casting a wider net here and saying the 'other' cannot be a
29+
// derived type, which is probably too wide, but I think anything
30+
//loosely matching this pattern should be ignored.
31+
other.getUnspecifiedType() instanceof DerivedType
3432
)
3533
}
3634

0 commit comments

Comments
 (0)