From de627b7e9e74f0b373fdb7fa4e6bb95260c2b0fa Mon Sep 17 00:00:00 2001 From: SAY-5 Date: Thu, 23 Apr 2026 12:25:38 -0700 Subject: [PATCH] fix(searchutil): nil-guard ResultItem.ToArtifact against nil receiver Multi-arch container push callers in jfrog-cli-artifactory (OCI buildinfo.createPushBuildProperties) reach ToArtifact on a nil *ResultItem when the manifest-digest SHA lookup misses in Artifactory. The direct item.Name deref crashed the build with 'invalid memory address or nil pointer dereference' and took the entire jenkins build down. Return a zero-value buildinfo.Artifact when item is nil so callers see an empty record and can handle it as 'no matching artifact' upstream, rather than fatally panicking the process. Refs jfrog/jfrog-cli issue 3450. Signed-off-by: SAY-5 --- artifactory/services/utils/searchutil.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/artifactory/services/utils/searchutil.go b/artifactory/services/utils/searchutil.go index 62422888f..03e60facd 100644 --- a/artifactory/services/utils/searchutil.go +++ b/artifactory/services/utils/searchutil.go @@ -455,6 +455,16 @@ func (item ResultItem) GetItemRelativeLocation() string { } func (item *ResultItem) ToArtifact() buildinfo.Artifact { + // Multi-arch container push callers (jfrog-cli-artifactory OCI + // buildinfo.createPushBuildProperties) reach ToArtifact on the + // zero-value element of a nil ResultItem pointer when the + // manifest-digest SHA lookup misses in Artifactory. The previous + // code then SIGSEGV'd on item.Name and took the whole build down. + // Return a zero Artifact instead so the caller sees an empty + // result and can handle it as "no matching artifact" upstream. + if item == nil { + return buildinfo.Artifact{} + } return buildinfo.Artifact{ Name: item.Name, Checksum: buildinfo.Checksum{