Skip to content

Commit c9ed039

Browse files
committed
CPP: Support builtin offsetof.
1 parent 4c6cc3a commit c9ed039

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cpp/ql/src/semmle/code/cpp/commons/Buffer.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ predicate memberMayBeVarSize(Class c, MemberVariable v) {
4040
) or exists(AddressOfExpr aoe |
4141
// `&(c.v)` is taken
4242
aoe.getAddressable() = v
43+
) or exists(BuiltInOperationOffsetOf oo |
44+
// `offsetof(c, v)` using a builtin
45+
oo.getAChild().(VariableAccess).getTarget() = v
4346
)
4447
)
4548
}

0 commit comments

Comments
 (0)