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 {
4
4
return "untrusted data"
5
5
}
6
6
7
- func sink (string ) {
7
+ func sink (any ) {
8
8
}
9
9
10
10
type A struct {
@@ -19,6 +19,10 @@ func functionWithVarArgsParameter(s ...string) string {
19
19
return s [1 ]
20
20
}
21
21
22
+ func functionWithVarArgsOutParameter (in string , out ... * string ) {
23
+ * out [0 ] = in
24
+ }
25
+
22
26
func functionWithSliceOfStructsParameter (s []A ) string {
23
27
return s [1 ].f
24
28
}
@@ -38,6 +42,12 @@ func main() {
38
42
sink (functionWithVarArgsParameter (sSlice ... )) // $ hasValueFlow="call to functionWithVarArgsParameter"
39
43
sink (functionWithVarArgsParameter (s0 , s1 )) // $ hasValueFlow="call to functionWithVarArgsParameter"
40
44
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
+
41
51
sliceOfStructs := []A {{f : source ()}}
42
52
sink (sliceOfStructs [0 ].f ) // $ hasValueFlow="selection of f"
43
53
You can’t perform that action at this time.
0 commit comments