aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/exec.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/exec.go')
-rw-r--r--internal/pkg/exec.go25
1 files changed, 19 insertions, 6 deletions
diff --git a/internal/pkg/exec.go b/internal/pkg/exec.go
index c51cd701..539bd935 100644
--- a/internal/pkg/exec.go
+++ b/internal/pkg/exec.go
@@ -84,9 +84,17 @@ func (a *execArtifact) Kind() Kind { return KindExec }
func (a *execArtifact) Params() []byte {
var buf bytes.Buffer
for _, p := range a.paths {
- buf.WriteString(p.P.String())
- id := Ident(p.A)
- buf.Write(id[:])
+ if p.P != nil {
+ buf.WriteString(p.P.String())
+ } else {
+ buf.WriteString("invalid P\x00")
+ }
+ if p.A != nil {
+ id := Ident(p.A)
+ buf.Write(id[:])
+ } else {
+ buf.WriteString("invalid A\x00")
+ }
}
buf.WriteByte(0)
buf.WriteString(a.dir.String())
@@ -106,9 +114,11 @@ func (a *execArtifact) Params() []byte {
// Dependencies returns a slice of all artifacts collected from caller-supplied
// [ExecContainerPath].
func (a *execArtifact) Dependencies() []Artifact {
- artifacts := make([]Artifact, len(a.paths))
- for i, p := range a.paths {
- artifacts[i] = p.A
+ artifacts := make([]Artifact, 0, len(a.paths))
+ for _, p := range a.paths {
+ if p.A != nil {
+ artifacts = append(artifacts, p.A)
+ }
}
return artifacts
}
@@ -123,6 +133,9 @@ func (a *execArtifact) Cure(c *CureContext) (err error) {
paths := make([][2]*check.Absolute, len(a.paths))
for i, p := range a.paths {
+ if p.P == nil || p.A == nil {
+ return os.ErrInvalid
+ }
paths[i][1] = p.P
}