Go: add test with Argument[0..2] spec

This commit is contained in:
Asger Feldthaus
2022-02-11 08:32:44 +01:00
parent 6d4b4df717
commit a26bfb0926
4 changed files with 10 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
invalidModelRow
| Unrecognized input specification "Argument[0..2]" in sink model. |
#select
| test.go:47:10:47:12 | arg | qltest |
| test.go:48:2:48:13 | type assertion | qltest |

View File

@@ -9,7 +9,8 @@ class SinkModelTest extends SinkModelCsv {
[
//`namespace; type; subtypes; name; -; ext; input; kind`
"github.com/nonexistent/test;B;false;Sink1;;;Argument[0];qltest",
"github.com/nonexistent/test;B;false;SinkMethod;;;Argument[-1];qltest"
"github.com/nonexistent/test;B;false;SinkMethod;;;Argument[-1];qltest",
"github.com/nonexistent/test;B;false;SinkManyArgs;;;Argument[0..2];qltest",
]
}
}

View File

@@ -140,4 +140,10 @@ func simpleflow() {
c4.Set(a.Src1().(string))
c4.Set("")
b.Sink1(c4.Get()) // $ SPURIOUS: hasTaintFlow="call to Get" // because we currently don't clear content
arg1 := src
arg2 := src
arg3 := src
arg4 := src
b.SinkManyArgs(arg1, arg2, arg3, arg4) // $ hasTaintFlow="arg1" hasTaintFlow="arg2" hasTaintFlow="arg3"
}

View File

@@ -58,6 +58,7 @@ func (a *A1) SrcArg(arg interface{}) {}
type B interface {
Sink1(arg interface{})
SinkMethod() interface{}
SinkManyArgs(arg1 interface{}, arg2 interface{}, arg3 interface{}, arg4 interface{})
}
type C struct {