Skip to content

Conversation

@phameratl
Copy link

A malformed expression ("WITH" followed by no tokens) will cause a panic.

Copilot AI review requested due to automatic review settings January 16, 2026 14:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a panic that occurs when parsing a malformed SPDX expression where "WITH" is followed by no tokens. The fix adds a nil check before accessing the token's role property.

Changes:

  • Added nil check in parseWith() to prevent panic when no tokens follow "WITH"
  • Added test case to verify the fix handles malformed expressions correctly

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
spdxexp/parse.go Added nil check before accessing token role to prevent panic
spdxexp/parse_test.go Added test case and helper function for malformed WITH clause scenario

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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