Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d5c8ea3

Browse files
committed
SuspiciousCallToMemset: Simplify pointer indirection computation
1 parent 5e7b781 commit d5c8ea3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

cpp/ql/src/Likely Bugs/Memory Management/SuspiciousCallToMemset.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ Type stripType(Type t) {
5252

5353
/**
5454
* Holds if `t` points to `base` via a specified number of levels of pointer
55-
* indirection. Intermediate typedefs and array types are allowed.
55+
* indirection. Intermediate typedefs and array types are allowed. Note that
56+
* `base` is a stripped type (via `stripType`).
5657
*/
5758
predicate pointerIndirection(Type t, int indirection, Type base) {
58-
exists(Type u |
59-
u = stripType(t) and
60-
u = stripType(base) and
61-
not u instanceof PointerType and
59+
(
60+
base = stripType(t) and
61+
not base instanceof PointerType and
6262
indirection = 0
6363
) or (
6464
pointerIndirection(stripType(t).(PointerType).getBaseType(), indirection - 1, base)

0 commit comments

Comments
 (0)