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

Fix panic in outliner #190

Merged
merged 1 commit into from
Nov 3, 2022
Merged

Conversation

puerco
Copy link
Member

@puerco puerco commented Nov 3, 2022

What type of PR is this?

:
/kind bug

What this PR does / why we need it:

This commit fixes a panic in the document outliner where bom would crash when the sbom contains files at the top level of the sbom:

om document outline example11/spdx/sbom.spdx.json 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x85b8be]

goroutine 1 [running]:
sigs.k8s.io/bom/pkg/spdx.parseJSON(0x7ffc5908f0e5?)
	sigs.k8s.io/bom/pkg/spdx/parser.go:374 +0x111e
sigs.k8s.io/bom/pkg/spdx.OpenDoc({0x7ffc5908f0e5?, 0x1d?})
	sigs.k8s.io/bom/pkg/spdx/parser.go:86 +0x346
sigs.k8s.io/bom/cmd/bom/cmd.AddOutline.func1(0xc000248600?, {0xc0001efa70?, 0x1?, 0x1?})
	sigs.k8s.io/bom/cmd/bom/cmd/document.go:119 +0x3f
github.com/spf13/cobra.(*Command).execute(0xc000248600, {0xc0001efa30, 0x1, 0x1})
	github.com/spf13/cobra@v1.6.0/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xd793e0)
	github.com/spf13/cobra@v1.6.0/command.go:1040 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.6.0/command.go:968
sigs.k8s.io/bom/cmd/bom/cmd.Execute()
	sigs.k8s.io/bom/cmd/bom/cmd/root.go:71 +0x25
main.main()
	./main.go:24 +0x17

Signed-off-by: Adolfo García Veytia (Puerco) puerco@chainguard.dev

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

/assign @saschagrunert @cpanato @xmudrii

Does this PR introduce a user-facing change?

Fixed a bug where bom would crash when outlining an SBOM containing files at the top level of the document..

This commit fixes a panic in the document outliner where
bom would crash when the sbom contains files at the top
level of the sbom.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 3, 2022
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 3, 2022
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 3, 2022
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/lgtm

thanks

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 3, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, puerco

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit f0fae67 into kubernetes-sigs:main Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants