Skip to content

Commit a01169e

Browse files
committed
add "Dereference" content for PointerContent
1 parent 579c56c commit a01169e

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

go/ql/lib/semmle/go/dataflow/ExternalFlow.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ predicate parseContent(string component, DataFlow::Content content) {
342342
component = "MapKey" and content instanceof DataFlow::MapKeyContent
343343
or
344344
component = "MapValue" and content instanceof DataFlow::MapValueContent
345+
or
346+
component = "Dereference" and content instanceof DataFlow::PointerContent
345347
}
346348

347349
cached

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlow/completetest.ext.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ extensions:
2222
- ["github.com/nonexistent/test", "", False, "GetMapKey", "", "", "Argument[0].MapKey", "ReturnValue", "value", "manual"]
2323
- ["github.com/nonexistent/test", "", False, "SetElement", "", "", "Argument[0]", "ReturnValue.Element", "value", "manual"]
2424
- ["github.com/nonexistent/test", "C", False, "Get", "", "", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
25-
- ["github.com/nonexistent/test", "C", False, "GetThroughPointer", "", "", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
25+
- ["github.com/nonexistent/test", "C", False, "GetThroughPointer", "", "", "Argument[-1].Dereference.Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
2626
- ["github.com/nonexistent/test", "C", False, "Set", "", "", "Argument[0]", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "value", "manual"]
27-
- ["github.com/nonexistent/test", "C", False, "SetThroughPointer", "", "", "Argument[0]", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "value", "manual"]
27+
- ["github.com/nonexistent/test", "C", False, "SetThroughPointer", "", "", "Argument[0]", "Argument[-1].Dereference.Field[github.com/nonexistent/test.C.F]", "value", "manual"]
2828

2929
- addsTo:
3030
pack: codeql/go-all

go/ql/test/library-tests/semmle/go/dataflow/ExternalFlow/test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ func simpleflow() {
143143

144144
cp1 := &test.C{""}
145145
cp1.SetThroughPointer(a.Src1().(string))
146-
b.Sink1(cp1.F) // $ MISSING: hasTaintFlow="selection of F"
146+
b.Sink1(cp1.F) // $ hasTaintFlow="selection of F"
147147

148148
cp2 := &test.C{a.Src1().(string)}
149-
b.Sink1(cp2.GetThroughPointer()) // $ MISSING: hasTaintFlow="call to GetThroughPointer"
149+
b.Sink1(cp2.GetThroughPointer()) // $ hasTaintFlow="call to GetThroughPointer"
150150

151151
cp3 := &test.C{""}
152152
cp3.SetThroughPointer(a.Src1().(string))

0 commit comments

Comments
 (0)