Skip to content

fix: avoid nil pointer panic when vulnerability analysis omits response (#148)#149

Open
SAY-5 wants to merge 1 commit into
CycloneDX:mainfrom
SAY-5:fix-vuln-analysis-nil-response
Open

fix: avoid nil pointer panic when vulnerability analysis omits response (#148)#149
SAY-5 wants to merge 1 commit into
CycloneDX:mainfrom
SAY-5:fix-vuln-analysis-nil-response

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 12, 2026

Summary

The CycloneDX analysis.response array is optional. When a vulnerability has an analysis object but no response, HashmapVulnerability dereferenced the nil *[]string pointer and panicked with invalid memory address or nil pointer dereference at schema/bom_hash.go:392 (reported in #148, also reproduced locally).

This guards the dereference and keeps the existing UNDEFINED placeholder fallback.

Test

Added TestHashCDXVulnerabilityAnalysisWithoutResponse in schema/bom_hash_test.go, which panics on main and passes with the fix. go test ./schema/ and go vet ./schema/ pass.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 12, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

…s response (CycloneDX#148)

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@SAY-5 SAY-5 force-pushed the fix-vuln-analysis-nil-response branch from 43c9017 to 59e4a4c Compare May 12, 2026 20:24
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