Skip to content

protobuf nil checks#1857

Merged
0xAustinWang merged 1 commit intomainfrom
aw/pbnilchecks
Mar 17, 2026
Merged

protobuf nil checks#1857
0xAustinWang merged 1 commit intomainfrom
aw/pbnilchecks

Conversation

@0xAustinWang
Copy link
Collaborator

No description provided.

Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

Changes look good because GetS() and GetR() are safe to use with a nil receiver object.

@0xAustinWang 0xAustinWang marked this pull request as ready for review March 17, 2026 18:27
@0xAustinWang 0xAustinWang requested a review from a team as a code owner March 17, 2026 18:27
Copilot AI review requested due to automatic review settings March 17, 2026 18:27
@0xAustinWang 0xAustinWang requested a review from a team as a code owner March 17, 2026 18:27
@0xAustinWang 0xAustinWang enabled auto-merge March 17, 2026 18:27
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 updates protobuf field access to use generated getters for ECDSA signature R/S byte fields, improving safety when protobuf messages may be nil.

Changes:

  • Replaced direct protobuf field reads (.R/.S) with getters (GetR()/GetS()) when translating signatures.
  • Updated signature length validation to use getters, avoiding potential nil dereferences.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +76 to 78
if len(pbSigs[i].GetR()) != 32 || len(pbSigs[i].GetS()) != 32 {
return nil, fmt.Errorf("signature must be 32 bytes: %v", pbSigs[i])
}
@github-actions
Copy link

Metric aw/pbnilchecks main
Coverage 70.1% 69.8%

@0xAustinWang 0xAustinWang added this pull request to the merge queue Mar 17, 2026
Merged via the queue into main with commit 1e72f69 Mar 17, 2026
58 of 59 checks passed
@0xAustinWang 0xAustinWang deleted the aw/pbnilchecks branch March 17, 2026 19:05
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.

4 participants