Skip to content

Commit

Permalink
Add error handling to test
Browse files Browse the repository at this point in the history
  • Loading branch information
egregius313 committed Jan 7, 2025
1 parent 60cf1ec commit b3d8c6b
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ func testConnQuery(conn *sql.Conn) {
var id int
var name string
err = rows.Scan(&id, &name)
if err != nil {
return
}

sink(id, name) // $ hasTaintFlow="id" hasTaintFlow="name"
}
Expand Down Expand Up @@ -50,6 +53,10 @@ func testDBQuery(db *sql.DB) {
var name string
err = rows.Scan(&id, &name)

if err != nil {
return
}

sink(id, name) // $ hasTaintFlow="id" hasTaintFlow="name"
}

Expand Down Expand Up @@ -84,6 +91,10 @@ func testStmtQuery(stmt *sql.Stmt) {
var name string
err = rows.Scan(&id, &name)

if err != nil {
return
}

sink(id, name) // $ hasTaintFlow="id" hasTaintFlow="name"
}

Expand All @@ -94,6 +105,10 @@ func testStmtQuery(stmt *sql.Stmt) {

err = row.Scan(&id, &name)

if err != nil {
return
}

sink(id, name) // $ hasTaintFlow="id" hasTaintFlow="name"

dog := stmt.QueryRow("SELECT * FROM dogs WHERE id = 1") // $ source
Expand All @@ -117,6 +132,10 @@ func testTxQuery(tx *sql.Tx) {
var name string
err = rows.Scan(&id, &name)

if err != nil {
return
}

sink(id, name) // $ hasTaintFlow="id" hasTaintFlow="name"
}

Expand All @@ -127,6 +146,10 @@ func testTxQuery(tx *sql.Tx) {

err = row.Scan(&id, &name)

if err != nil {
return
}

sink(id, name) // $ hasTaintFlow="id" hasTaintFlow="name"

dog := tx.QueryRow("SELECT * FROM dogs WHERE id = 1") // $ source
Expand Down

0 comments on commit b3d8c6b

Please sign in to comment.