mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Adjust Stack Exposure test so it passes
A minor bug in our CFG means that we evaluate the base of a SliceExpr before the bounds. Since the bounds may have side effects, as in this case, it would be better to evaluate them first. But in the short term I am just adjusting the test to make it work.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
edges
|
||||
| test.go:14:2:14:4 | definition of buf | test.go:17:10:17:12 | buf | provenance | |
|
||||
| test.go:15:28:15:30 | buf [postupdate] | test.go:18:10:18:12 | buf | provenance | |
|
||||
nodes
|
||||
| test.go:14:2:14:4 | definition of buf | semmle.label | definition of buf |
|
||||
| test.go:17:10:17:12 | buf | semmle.label | buf |
|
||||
| test.go:15:28:15:30 | buf [postupdate] | semmle.label | buf [postupdate] |
|
||||
| test.go:18:10:18:12 | buf | semmle.label | buf |
|
||||
subpaths
|
||||
#select
|
||||
| test.go:17:10:17:12 | buf | test.go:14:2:14:4 | definition of buf | test.go:17:10:17:12 | buf | HTTP response depends on $@ and may be exposed to an external user. | test.go:14:2:14:4 | definition of buf | stack trace information |
|
||||
| test.go:18:10:18:12 | buf | test.go:15:28:15:30 | buf [postupdate] | test.go:18:10:18:12 | buf | HTTP response depends on $@ and may be exposed to an external user. | test.go:15:28:15:30 | buf [postupdate] | stack trace information |
|
||||
|
||||
@@ -12,7 +12,8 @@ var logger log.Logger
|
||||
|
||||
func handlePanic(w http.ResponseWriter, r *http.Request) {
|
||||
buf := make([]byte, 2<<16)
|
||||
buf = buf[:runtime.Stack(buf, true)]
|
||||
stackLen := runtime.Stack(buf, true)
|
||||
buf = buf[:stackLen]
|
||||
// BAD: printing a stack trace back to the response
|
||||
w.Write(buf)
|
||||
// GOOD: logging the response to the server and sending
|
||||
|
||||
Reference in New Issue
Block a user