Skip to content
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

Invalid interface conversion in Swift cataloger #2225

Closed
elifarley opened this issue Oct 12, 2023 · 0 comments · Fixed by #2226
Closed

Invalid interface conversion in Swift cataloger #2225

elifarley opened this issue Oct 12, 2023 · 0 comments · Fixed by #2226
Assignees
Labels
bug Something isn't working

Comments

@elifarley
Copy link

elifarley commented Oct 12, 2023

What happened:
When parsing an empty file named Package.resolved (for Swift / iOS), I got an error message:

1 error occurred:
	* interface conversion: interface {} is nil, not float64 at:
goroutine 84 [running]:
runtime/debug.Stack()
	/opt/hostedtoolcache/go/1.21.1/x64/src/runtime/debug/stack.go:24 +0x5e
github.com/anchore/syft/syft/pkg/cataloger.runCataloger.func1()
	/home/runner/work/syft/syft/syft/pkg/cataloger/catalog.go:57 +0x3d
panic({0x15f97a0?, 0xc0004c36b0?})
	/opt/hostedtoolcache/go/1.21.1/x64/src/runtime/panic.go:914 +0x21f
github.com/anchore/syft/syft/pkg/cataloger/swift.parsePackageResolved({0x1?, 0xc0004a3728?}, 0x453689?, {{{{{...}, {...}}, {0x0, 0x0}, {0x2, {...}}}, {0xc0004c34a0}}, ...})
	/home/runner/work/syft/syft/syft/pkg/cataloger/swift/parse_package_resolved.go:70 +0x538
github.com/anchore/syft/syft/pkg/cataloger/generic.(*Cataloger).Catalog(0xc0002ce810, {0x1db7638, 0xc0001ce360})
	/home/runner/work/syft/syft/syft/pkg/cataloger/generic/cataloger.go:129 +0x76e
github.com/anchore/syft/syft/pkg/cataloger.runCataloger({0x1da9240, 0xc0002ce810}, {0x1db7638?, 0xc0001ce360})
	/home/runner/work/syft/syft/syft/pkg/cataloger/catalog.go:65 +0x1ea
github.com/anchore/syft/syft/pkg/cataloger.Catalog.func1()
	/home/runner/work/syft/syft/syft/pkg/cataloger/catalog.go:146 +0xdc
created by github.com/anchore/syft/syft/pkg/cataloger.Catalog in goroutine 82
	/home/runner/work/syft/syft/syft/pkg/cataloger/catalog.go:141 +0x345

What you expected to happen:
No error would have happened.

An empty file should have been simply skipped, as there's nothing interesting in it.

Steps to reproduce the issue:

mkdir /tmp/syft-error
touch /tmp/syft-error/Package.resolved
syft packages dir:/tmp/syft-error 2>/dev/null

Anything else we need to know?:

Environment:

  • Output of syft version: 0.93.0
  • OS (e.g: cat /etc/os-release or similar): Ubuntu 22.04.3 LTS
@elifarley elifarley added the bug Something isn't working label Oct 12, 2023
@wagoodman wagoodman self-assigned this Oct 12, 2023
@wagoodman wagoodman changed the title interface {} is nil, not float64 in parse_package_resolved.go:70 Invalid interface conversion in Swift cataloger Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants