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 segfault and add (optional) variant in image config #123

Merged
merged 1 commit into from Jul 9, 2021

Conversation

tianon
Copy link
Contributor

@tianon tianon commented Jul 9, 2021

When using a YAML file that doesn't include platform: objects at all, the following is the result:

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

goroutine 1 [running]:
github.com/estesp/manifest-tool/pkg/registry.resolvePlatform(0xc000568840, 0x34, 0xc000578b90, 0x47, 0x20f, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/pkg/registry/push.go:126 +0xb9
github.com/estesp/manifest-tool/pkg/registry.PushManifestList(0x0, 0x0, 0x0, 0x0, 0xc00045a168, 0x15, 0x0, 0x0, 0x0, 0xc00040aa80, ...)
	/go/src/github.com/estesp/manifest-tool/pkg/registry/push.go:92 +0xdfb
main.glob..func2(0xc00044c420)
	/go/src/github.com/estesp/manifest-tool/cmd/manifest-tool/push.go:55 +0x3cf
github.com/urfave/cli.HandleAction(0x98c520, 0xa7a7b8, 0xc00044c420, 0xc00044c420, 0x0)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/app.go:525 +0x59
github.com/urfave/cli.Command.Run(0xa503af, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa68e68, 0x32, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/command.go:174 +0x579
github.com/urfave/cli.(*App).RunAsSubcommand(0xc000472380, 0xc00044c160, 0x0, 0x0)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/app.go:404 +0x914
github.com/urfave/cli.Command.startApp(0xa4c181, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa6de45, 0x4e, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/command.go:373 +0x7ff
github.com/urfave/cli.Command.Run(0xa4c181, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa6de45, 0x4e, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/command.go:102 +0xa14
github.com/urfave/cli.(*App).Run(0xc0004721c0, 0xc000020080, 0x4, 0x4, 0x0, 0x0)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/app.go:276 +0x7e8
main.runApplication(0xc000000180, 0xc00025ff78)
	/go/src/github.com/estesp/manifest-tool/cmd/manifest-tool/main.go:75 +0x605
main.main()
	/go/src/github.com/estesp/manifest-tool/cmd/manifest-tool/main.go:20 +0x26

When using a YAML file that doesn't include `platform:` objects at all, the following is the result:

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

goroutine 1 [running]:
github.com/estesp/manifest-tool/pkg/registry.resolvePlatform(0xc000568840, 0x34, 0xc000578b90, 0x47, 0x20f, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/pkg/registry/push.go:126 +0xb9
github.com/estesp/manifest-tool/pkg/registry.PushManifestList(0x0, 0x0, 0x0, 0x0, 0xc00045a168, 0x15, 0x0, 0x0, 0x0, 0xc00040aa80, ...)
	/go/src/github.com/estesp/manifest-tool/pkg/registry/push.go:92 +0xdfb
main.glob..func2(0xc00044c420)
	/go/src/github.com/estesp/manifest-tool/cmd/manifest-tool/push.go:55 +0x3cf
github.com/urfave/cli.HandleAction(0x98c520, 0xa7a7b8, 0xc00044c420, 0xc00044c420, 0x0)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/app.go:525 +0x59
github.com/urfave/cli.Command.Run(0xa503af, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa68e68, 0x32, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/command.go:174 +0x579
github.com/urfave/cli.(*App).RunAsSubcommand(0xc000472380, 0xc00044c160, 0x0, 0x0)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/app.go:404 +0x914
github.com/urfave/cli.Command.startApp(0xa4c181, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa6de45, 0x4e, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/command.go:373 +0x7ff
github.com/urfave/cli.Command.Run(0xa4c181, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa6de45, 0x4e, 0x0, ...)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/command.go:102 +0xa14
github.com/urfave/cli.(*App).Run(0xc0004721c0, 0xc000020080, 0x4, 0x4, 0x0, 0x0)
	/go/src/github.com/estesp/manifest-tool/vendor/github.com/urfave/cli/app.go:276 +0x7e8
main.runApplication(0xc000000180, 0xc00025ff78)
	/go/src/github.com/estesp/manifest-tool/cmd/manifest-tool/main.go:75 +0x605
main.main()
	/go/src/github.com/estesp/manifest-tool/cmd/manifest-tool/main.go:20 +0x26
```

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
@tianon
Copy link
Contributor Author

tianon commented Jul 9, 2021

(To be clear, I don't do this often, but when I do... no, I just happened to have a test YAML lying around that I wanted/needed to test a build against and it happened to not specify platform: at all so I found this bug 😄)

Copy link
Owner

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp
Copy link
Owner

estesp commented Jul 9, 2021

Thanks @tianon ; good find, even if unexpected :)

@estesp estesp merged commit b2404bf into estesp:main Jul 9, 2021
@tianon tianon deleted the variant branch July 9, 2021 15:51
@tianon tianon mentioned this pull request Jul 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

2 participants