Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 035823c commit 2dcec4dCopy full SHA for 2dcec4d
1 file changed
cpp/ql/src/semmle/code/cpp/commons/Buffer.qll
@@ -34,13 +34,12 @@ predicate memberMayBeVarSize(Class c, MemberVariable v) {
34
// `sizeof(c)` is taken
35
so.(SizeofTypeOperator).getTypeOperand().getUnspecifiedType() = c or
36
so.(SizeofExprOperator).getExprOperand().getType().getUnspecifiedType() = c |
37
- // Check all ancestor nodes except the immediate parent for
38
- // allocations.
39
- isStdLibAllocationExpr(so.getParent().(Expr).getParent+())
+
+ // arithmetic is performed on the result
+ so.getParent*() instanceof BinaryArithmeticOperation
40
) or exists(AddressOfExpr aoe |
41
// `&(c.v)` is taken
42
- aoe.getAddressable() = v and
43
- isStdLibAllocationExpr(aoe.getParent().(Expr).getParent+())
+ aoe.getAddressable() = v
44
)
45
46
}
0 commit comments