Skip to content

Commit

Permalink
consider int overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
muraty committed Oct 16, 2020
1 parent d4da656 commit f68a872
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/property/biginteger.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ func (t BigInteger) ConvertValue(v interface{}) (driver.Value, error) {
case int8:
return int64(i), nil
case uint:
if i > math.MaxInt64 {
if i > math.MaxUint32 {
return nil, fmt.Errorf("number is greater then max big_integer value: %v", v)
}
return int64(i), nil
case uint64:
if i > math.MaxInt64 {
if i > math.MaxUint64 {
return nil, fmt.Errorf("number is greater then max big_integer value: %v", v)
}
return int64(i), nil
Expand Down
2 changes: 1 addition & 1 deletion internal/property/integer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (t Integer) int64(v interface{}) (int64, error) {
case int8:
return int64(i), nil
case uint:
if i > math.MaxInt64 {
if i > math.MaxUint32 {
return 0, fmt.Errorf("number is greater then max integer value: %v", v)
}
return int64(i), nil
Expand Down

0 comments on commit f68a872

Please sign in to comment.