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

fix: build on 32-bit architectures #821

Merged
merged 1 commit into from
Nov 13, 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
8 changes: 4 additions & 4 deletions hasherx/hash_comparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func decodeArgon2idHash(encodedHash string) (p *Argon2Config, salt, hash []byte,
if err != nil {
return nil, nil, nil, err
}
saltLength := len(salt)
saltLength := uint(len(salt))
if saltLength > math.MaxUint32 {
return nil, nil, nil, ErrInvalidHash
}
Expand All @@ -174,7 +174,7 @@ func decodeArgon2idHash(encodedHash string) (p *Argon2Config, salt, hash []byte,
if err != nil {
return nil, nil, nil, err
}
keyLength := len(hash)
keyLength := uint(len(hash))
if keyLength > math.MaxUint32 {
return nil, nil, nil, ErrInvalidHash
}
Expand Down Expand Up @@ -207,7 +207,7 @@ func decodePbkdf2Hash(encodedHash string) (p *PBKDF2Config, salt, hash []byte, e
if err != nil {
return nil, nil, nil, err
}
saltLength := len(salt)
saltLength := uint(len(salt))
if saltLength > math.MaxUint32 {
return nil, nil, nil, ErrInvalidHash
}
Expand All @@ -217,7 +217,7 @@ func decodePbkdf2Hash(encodedHash string) (p *PBKDF2Config, salt, hash []byte, e
if err != nil {
return nil, nil, nil, err
}
keyLength := len(hash)
keyLength := uint(len(hash))
if keyLength > math.MaxUint32 {
return nil, nil, nil, ErrInvalidHash
}
Expand Down
5 changes: 3 additions & 2 deletions mapx/type_assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ func GetInt64[K comparable](values map[K]any, key K) (int64, error) {
case int32:
return int64(v), nil
case uint:
if v > math.MaxInt64 {
vv := uint64(v)
if vv > math.MaxInt64 {
return 0, errors.New("value is out of range")
}
return int64(v), nil
return int64(vv), nil
case uint32:
return int64(v), nil
case uint64:
Expand Down
Loading