Skip to content

fix: add nil checks to BinarySource methods#1

Merged
qj0r9j0vc2 merged 1 commit intomainfrom
qj0r9j0vc2/fix-nil-ptr-upgrade
Jan 20, 2026
Merged

fix: add nil checks to BinarySource methods#1
qj0r9j0vc2 merged 1 commit intomainfrom
qj0r9j0vc2/fix-nil-ptr-upgrade

Conversation

@qj0r9j0vc2
Copy link
Copy Markdown
Member

Summary

  • Add nil receiver checks to BinarySource methods to prevent SIGSEGV panic
  • IsLocal(), IsGitHubRelease(), IsValid() return false when nil
  • MarkValid(), MarkInvalid() are no-ops when nil
  • Validate() returns descriptive error when nil

Problem

The upgrade command panics with nil pointer dereference at binary_source.go:149 when BinarySource is nil:

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

goroutine 1 [running]:
github.com/altuslabsxyz/devnet-builder/internal/domain.(*BinarySource).IsLocal(0x1da21a0?)
        /home/ubuntu/devnet-builder/internal/domain/binary_source.go:149
github.com/altuslabsxyz/devnet-builder/cmd/devnet-builder/commands/manage.runUpgrade(...)
        /home/ubuntu/devnet-builder/cmd/devnet-builder/commands/manage/upgrade.go:294

Root Cause

At upgrade.go:294, selection.BinarySource.IsLocal() is called without nil check. The interactive selection can return nil BinarySource in certain flows.

Test plan

  • Added unit test TestBinarySourceNilSafety verifying all methods handle nil safely
  • go build ./... passes
  • go test ./internal/domain/... passes

@qj0r9j0vc2 qj0r9j0vc2 self-assigned this Jan 20, 2026
@qj0r9j0vc2 qj0r9j0vc2 merged commit 7fe86bb into main Jan 20, 2026
10 checks passed
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.

1 participant