@@ -1288,13 +1288,15 @@ func (s *TaintSwitcher) passStaticCallTaint(f *ssa.Function, inst *ssa.Call) {
12881288 }
12891289 } else {
12901290 // if the function has no receiver
1291- if f .Signature .Results ().Len () == 1 {
1292- // if the function has one result
1293- (* s .outMap )[inst .Name ()] = newTaints [i ]
1294- } else if i < f .Signature .Results ().Len () {
1295- // else mark the variables as "inst.Name().X"
1296- // e.g. t0.1, t0.2
1297- (* s .outMap )[inst .Name ()+ "." + strconv .Itoa (i )] = newTaints [i ]
1291+ if i < f .Signature .Results ().Len () {
1292+ if f .Signature .Results ().Len () == 1 {
1293+ // if the function has one result
1294+ (* s .outMap )[inst .Name ()] = newTaints [i ]
1295+ } else {
1296+ // else mark the variables as "inst.Name().X"
1297+ // e.g. t0.1, t0.2
1298+ (* s .outMap )[inst .Name ()+ "." + strconv .Itoa (i )] = newTaints [i ]
1299+ }
12981300 } else {
12991301 // update args' taint
13001302 (* s .outMap )[inst .Call .Args [i - f .Signature .Results ().Len ()].Name ()] = newTaints [i ]
@@ -1519,13 +1521,15 @@ func (s *TaintSwitcher) passMethodTaint(f *ssa.Function, inst *ssa.Call) {
15191521 s .passPointTaint (newTaints [i ], inst .Call .Value )
15201522 }
15211523 } else {
1522- if f .Signature .Results ().Len () == 1 {
1523- // if the function has one result
1524- (* s .outMap )[inst .Name ()] = newTaints [i ]
1525- } else if i < 1 + f .Signature .Results ().Len () {
1526- // else mark the variables as "inst.Name().X"
1527- // e.g. t0.1, t0.2
1528- (* s .outMap )[inst .Name ()+ "." + strconv .Itoa (i - 1 )] = newTaints [i ]
1524+ if i < 1 + f .Signature .Results ().Len () {
1525+ if f .Signature .Results ().Len () == 1 {
1526+ // if the function has one result
1527+ (* s .outMap )[inst .Name ()] = newTaints [i ]
1528+ } else {
1529+ // else mark the variables as "inst.Name().X"
1530+ // e.g. t0.1, t0.2
1531+ (* s .outMap )[inst .Name ()+ "." + strconv .Itoa (i - 1 )] = newTaints [i ]
1532+ }
15291533 } else {
15301534 // update args' taint
15311535 (* s .outMap )[inst .Call .Args [i - f .Signature .Results ().Len ()- 1 ].Name ()] = newTaints [i ]
0 commit comments