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

Check for nil graph from empty Cartfile.resolved #435

Merged
merged 1 commit into from Apr 8, 2019

Conversation

StefanScherer
Copy link
Contributor

A follow-up for the panic in #430

If the Cartfile.resolved is empty then cartfileGraph is nil.

Without that check fossa-cli runs into

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x15af891]

goroutine 1 [running]:
github.com/fossas/fossa-cli/buildtools/carthage.FromResolvedCartfile(0xc00002cd0b, 0xd, 0xc00002d320, 0x28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/buildtools/carthage/cartfile.go:98 +0x2f1
github.com/fossas/fossa-cli/buildtools/carthage.Requirement.Package(0xc0000278e0, 0x6, 0xc00002ccf0, 0x28, 0xc0000278e6, 0x7, 0xc00002cd0b, 0xd, 0xc000152c38, 0x7, ...)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/buildtools/carthage/cartfile.go:50 +0x39e
github.com/fossas/fossa-cli/buildtools/carthage.RecurseDeps(0xc000246090, 0x185e583, 0x4, 0x0, 0x0, 0xc000148400, 0x8, 0x8, 0xc000152c38, 0x7)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/buildtools/carthage/cartfile.go:167 +0x2f2
github.com/fossas/fossa-cli/analyzers/carthage.(*Analyzer).Analyze(0xc0000c79a0, 0x1, 0x0, 0x0, 0xc000152c20, 0x7, 0xc000152c38)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/analyzers/carthage/carthage.go:166 +0x726
github.com/fossas/fossa-cli/cmd/fossa/cmd/analyze.Do(0xc000202000, 0x22, 0x27, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/cmd/fossa/cmd/analyze/analyze.go:122 +0x9a8
github.com/fossas/fossa-cli/cmd/fossa/cmd/analyze.Run(0xc0000b69a0, 0x0, 0xc0000b69a0)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/cmd/fossa/cmd/analyze/analyze.go:48 +0xf6
github.com/fossas/fossa-cli/vendor/github.com/urfave/cli.HandleAction(0x173e4a0, 0x188aa60, 0xc0000b69a0, 0xc000036700, 0x0)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/vendor/github.com/urfave/cli/app.go:490 +0xc8
github.com/fossas/fossa-cli/vendor/github.com/urfave/cli.Command.Run(0x185fa06, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x186c149, 0x1a, 0x0, ...)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/vendor/github.com/urfave/cli/command.go:210 +0x92f
github.com/fossas/fossa-cli/vendor/github.com/urfave/cli.(*App).Run(0x1f29ca0, 0xc000020140, 0x4, 0x4, 0x0, 0x0)
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/vendor/github.com/urfave/cli/app.go:255 +0x69b
main.main()
	/Users/stefanscherer/.gvm/pkgsets/go1.12/global/src/github.com/fossas/fossa-cli/cmd/fossa/main.go:48 +0x55
~/.

Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
@CLAassistant
Copy link

CLAassistant commented Apr 7, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@zlav zlav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for the PR! I will add tests for this going forward.

@zlav zlav merged commit ebfa091 into fossas:master Apr 8, 2019
@StefanScherer StefanScherer deleted the ignore-empty-cartfile.resolved branch April 9, 2019 05:30
meghfossa pushed a commit that referenced this pull request Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants