Skip to content

Commit 4270407

Browse files
committed
Add failing tests highlighting missing models
1 parent ecd5c8c commit 4270407

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ func simpleflow() {
208208

209209
temp := test.SourceVariable
210210
test.SinkVariable = temp // $ hasValueFlow="temp"
211+
212+
b.Sink1(new(src)) // $ hasValueFlow="call to new"
213+
b.Sink1(*new(src)) // $ hasValueFlow="dereference"
211214
}
212215

213216
func srcParam(src string, b test.B) {

go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Builtin.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ func TaintStepTest_Min(sourceCQL interface{}) interface{} {
6060
return intoInterface
6161
}
6262

63+
func TaintStepTest_New(sourceCQL interface{}) interface{} {
64+
from := sourceCQL.(int)
65+
var intoInterface *int
66+
intoInterface = new(from)
67+
return *intoInterface
68+
}
69+
6370
func RunAllTaints_Builtin() {
6471
{
6572
source := newSource(0)
@@ -101,4 +108,9 @@ func RunAllTaints_Builtin() {
101108
out := TaintStepTest_Min(source)
102109
sink(4, out)
103110
}
111+
{
112+
source := newSource(5)
113+
out := TaintStepTest_New(source)
114+
sink(5, out)
115+
}
104116
}

go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Bytes.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Errors.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)