forked from github/securitylab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfield.qll
More file actions
40 lines (39 loc) · 1.08 KB
/
field.qll
File metadata and controls
40 lines (39 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import cpp
import common
import collections
import pointers.raw_ptr
/**
* An expression that assigns values to a general field. Can be an assignment,
* or an index expression that modifies a collection etc.
*/
Expr generalAssignValue(Field f) {
result = f.getAnAssignedValue()
or
//normal assignment
exists(GeneralAssignment expr |
expr.getLValue() = f.getAnAccess() and
expr.getRValue() = result
)
or
//Adding to a collection field
exists(FunctionCall fc |
fc.getTarget() instanceof AddToCollection and
result = fc.getAnArgument() and
getQualifier(fc) = f.getAnAccess()
)
or
//setting managed pointers.
exists(FunctionCall fc |
fc.getTarget() instanceof ManagedPtrSetFunction and
getQualifier(fc) = f.getAnAccess() and
result = fc.getAnArgument()
)
or
//index operator to assign values to a collection field.
exists(FunctionCall indexer, GeneralAssignment expr |
expr.getLValue() = indexer and
indexer.getTarget().hasName("operator[]") and
expr.getRValue() = result and
getQualifier(indexer) = f.getAnAccess()
)
}