Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle uint8 overflow #363

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/auth/authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (*authenticator) AuthenticateBlobRequest(header core.BlobAuthHeader) error
sig := header.AuthenticationData

// Ensure the signature is 65 bytes (Recovery ID is the last byte)
if sig == nil || len(sig) != 65 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't need a nil check for a slice

if len(sig) != 65 {
return fmt.Errorf("signature length is unexpected: %d", len(sig))
}

Expand Down
2 changes: 1 addition & 1 deletion core/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type BlobRequestHeader struct {
}

func (sp *SecurityParam) Validate() error {
if sp.ConfirmationThreshold < sp.AdversaryThreshold+10 {
if sp.ConfirmationThreshold < sp.AdversaryThreshold || sp.ConfirmationThreshold-sp.AdversaryThreshold < 10 {
return errors.New("invalid request: quorum threshold must be >= 10 + adversary threshold")
}
if sp.ConfirmationThreshold > 100 {
Expand Down
Loading