Skip to content

Check if frs sync.Map is nil within handleArchive#476

Merged
egibs merged 1 commit intochainguard-dev:mainfrom
egibs:more-sync-map-nil-checks
Oct 2, 2024
Merged

Check if frs sync.Map is nil within handleArchive#476
egibs merged 1 commit intochainguard-dev:mainfrom
egibs:more-sync-map-nil-checks

Conversation

@egibs
Copy link
Member

@egibs egibs commented Oct 2, 2024

@hectorj2f pointed out that we were still seeing nil pointer dereferences/panics when failing to scan archives (i.e., frs is nil):

[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x48955a]

goroutine 1652 [running]:
sync.(*Map).loadReadOnly(...)
	sync/map.go:114
sync.(*Map).Range(0x0?, 0x9a9154?)
	sync/map.go:478 +0x1a
github.com/chainguard-dev/malcontent/pkg/action.recursiveScan.func1({0xc00171fef0, 0x8d})
	github.com/chainguard-dev/malcontent/pkg/action/scan.go:246 +0x305
github.com/chainguard-dev/malcontent/pkg/action.recursiveScan.func3()
	github.com/chainguard-dev/malcontent/pkg/action/scan.go:292 +0x70
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	golang.org/x/sync@v0.8.0/errgroup/errgroup.go:75 +0x96

This is the same issue as #462 but I only fixed the bug in the errIfHitOrMiss.

Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs requested a review from hectorj2f October 2, 2024 11:52
@egibs egibs changed the title Check if frs Map is nil within handleArchive Check if frs sync.Map is nil within handleArchive Oct 2, 2024
@egibs egibs merged commit 69bb9d4 into chainguard-dev:main Oct 2, 2024
@egibs egibs deleted the more-sync-map-nil-checks branch October 2, 2024 12:15
@hectorj2f
Copy link
Member

Thanks @egibs

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.

3 participants