Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
| main.go:38:7:38:20 | composite literal | main.go:38:2:38:2 | definition of s |
| main.go:39:2:39:3 | definition of s1 | main.go:40:18:40:19 | s1 |
| main.go:39:8:39:25 | call to append | main.go:39:2:39:3 | definition of s1 |
| main.go:40:2:40:3 | definition of s2 | main.go:43:9:43:10 | s2 |
| main.go:40:8:40:23 | call to append | main.go:40:2:40:3 | definition of s2 |
| main.go:41:2:41:3 | definition of s4 | main.go:42:10:42:11 | s4 |
| main.go:41:8:41:21 | call to make | main.go:41:2:41:3 | definition of s4 |
| strings.go:8:12:8:12 | argument corresponding to s | strings.go:8:12:8:12 | definition of s |
Expand Down
3 changes: 2 additions & 1 deletion ql/test/library-tests/semmle/go/dataflow/FlowSteps/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ func main() {
test1(test2()(), test2())
}

func test9() {
func test9() []int {
s := []int{1, 2, 3}
s1 := append(s, 4, 5, 6)
s2 := append(s, s1...)
s4 := make([]int, 4)
copy(s, s4)
return s2
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ func main() {
// than the xor operator and so the query doesn't see a constant on the left
// hand side of ^.
fmt.Println(nonconst()*10 ^ 9)

fmt.Println(mask)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
| testdata.go:268:2:268:2 | assignment to x | This definition of x is never used. |
| testdata.go:309:2:309:2 | assignment to a | This definition of a is never used. |
| testdata.go:321:2:321:2 | assignment to a | This definition of a is never used. |
| testdata.go:385:3:385:3 | assignment to x | This definition of x is never used. |
| testdata.go:430:3:430:3 | assignment to x | This definition of x is never used. |
| testdata.go:387:3:387:3 | assignment to x | This definition of x is never used. |
| testdata.go:432:3:432:3 | assignment to x | This definition of x is never used. |
| testdata.go:439:2:439:2 | assignment to x | This definition of x is never used. |
| testdata.go:486:3:486:3 | assignment to x | This definition of x is never used. |
| testdata.go:540:3:540:3 | assignment to x | This definition of x is never used. |
| testdata.go:578:4:578:4 | assignment to x | This definition of x is never used. |
| testdata.go:434:3:434:3 | assignment to x | This definition of x is never used. |
| testdata.go:441:2:441:2 | assignment to x | This definition of x is never used. |
| testdata.go:488:3:488:3 | assignment to x | This definition of x is never used. |
| testdata.go:542:3:542:3 | assignment to x | This definition of x is never used. |
| testdata.go:580:4:580:4 | assignment to x | This definition of x is never used. |
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ func _() {
func _() {
var x int
switch b {
case true:
_ = x
default:
x = deadStore() // BAD
fallthrough
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
)

func encryptValueGood(v interface{}) ([]byte, error) {
func encryptValueGood2(v interface{}) ([]byte, error) {
jsonData, err := json.Marshal(v)
if err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package main

import "testing"
import (
"crypto/tls"
"net/http"
"testing"
)

func TestSomethingExciting(t *testing.T) {
transport := &http.Transport{
Expand Down