File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
go/ql/test/library-tests/semmle/go/dataflow/VarArgs Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ func source() string {
44 return "untrusted data"
55}
66
7- func sink (string ) {
7+ func sink (any ) {
88}
99
1010type A struct {
@@ -19,6 +19,10 @@ func functionWithVarArgsParameter(s ...string) string {
1919 return s [1 ]
2020}
2121
22+ func functionWithVarArgsOutParameter (in string , out ... * string ) {
23+ * out [0 ] = in
24+ }
25+
2226func functionWithSliceOfStructsParameter (s []A ) string {
2327 return s [1 ].f
2428}
@@ -38,6 +42,12 @@ func main() {
3842 sink (functionWithVarArgsParameter (sSlice ... )) // $ hasValueFlow="call to functionWithVarArgsParameter"
3943 sink (functionWithVarArgsParameter (s0 , s1 )) // $ hasValueFlow="call to functionWithVarArgsParameter"
4044
45+ var out1 * string
46+ var out2 * string
47+ functionWithVarArgsOutParameter (source (), out1 , out2 )
48+ sink (out1 ) // $ MISSING: hasValueFlow="out1"
49+ sink (out2 ) // $ MISSING: hasValueFlow="out2"
50+
4151 sliceOfStructs := []A {{f : source ()}}
4252 sink (sliceOfStructs [0 ].f ) // $ hasValueFlow="selection of f"
4353
You can’t perform that action at this time.
0 commit comments