-
Notifications
You must be signed in to change notification settings - Fork 18k
x/vuln: vulnerability scan crashes #63146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for the report. This is going to be hard to fix without a reproducer. Would it be possible for you to get us a minimized reproducer? The most helpful thing would be to get a simplified function body of the function that is crashing. (Debugging *builder.fun in a debugger or printf debugging via My current hunch from that stack trace is that (*vta.builder).fieldAddr may need to be updated to take a core type. That unfortunately probably means something else is off as I don't know why the type propagation graph would be being built for the generic code. If you are willing to get your hands a bit dirty you can see if this fixes you:
|
I'm seeing this bug too and I narrowed it down to a package's test files (using @timothy-king any tips on how to find the exact line that triggers this panic so I can provide a sample that reproduces the bug? |
I think this must be a race condition because I found the file that triggers the panic reliably locally and in a CI pipeline. But when I extract the structs and interfaces to a sample project it works fine. |
Never mind my previous comments, got something: package test
import (
"testing"
)
type type1 struct{ embedded }
type type2 struct{ embedded }
type oneOrTwo interface {
type1 | type2
}
type embedded struct {
id string
}
func generate[T oneOrTwo]() (T, error) {
return T{embedded{}}, nil
}
func MustGenerate[T oneOrTwo](tb testing.TB) T {
tb.Helper()
result, err := generate[T]()
if err != nil {
tb.Fatalf("generating: %v", err)
}
return result
} Add this as a package to project and run
Output
@timothy-king your suggested change actually fixes the panic! |
Change https://go.dev/cl/536035 mentions this issue: |
That reproducer is perfect. Thanks. |
@timothy-king It still crashes because the |
Updated x/vuln. Sync past https://go.dev/cl/544295. |
Thank you! |
panics, vs.
which doesn't. |
It works with |
What version of Go are you using (
go version
)?Does this issue reproduce at the latest version of golang.org/x/vuln?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I tried to scan a large repo for vulnerabilities, but
govulncheck
just panicked. Sadly, the repo is not open source, so I can only provide the stack trace.What did you expect to see?
A report about vulnerable dependencies.
What did you see instead?
A crash.
The text was updated successfully, but these errors were encountered: