mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
C++: using buildin offsetof for an array member indexed after end is legal
This commit is contained in:
@@ -130,7 +130,9 @@ predicate outOfBounds(BufferAccess bufaccess, string msg) {
|
||||
(
|
||||
access > size
|
||||
or
|
||||
access = size and not exists(AddressOfExpr addof | bufaccess = addof.getOperand())
|
||||
access = size and
|
||||
not exists(AddressOfExpr addof | bufaccess = addof.getOperand()) and
|
||||
not exists(BuiltInOperationBuiltInOffsetOf offsetof | offsetof.getAChild() = bufaccess)
|
||||
) and
|
||||
msg =
|
||||
"Potential buffer-overflow: '" + buf + "' has size " + size.toString() + " but '" + buf + "[" +
|
||||
|
||||
Reference in New Issue
Block a user