You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You clam your library to be "safe casting from one type to another in Go", but in the code there are no checks for overflow when casting integer types:
switchs:=i.(type) {
caseint:
returnint16(s), nil// <-- this may overflowcaseint64:
returnint16(s), nil// <-- this may overflowcaseint32:
returnint16(s), nilcaseint16:
returns, nilcaseint8:
returnint16(s), nilcaseuint:
returnint16(s), nil// <-- this may overflowcaseuint64:
returnint16(s), nil// <-- this may overflowcaseuint32:
returnint16(s), nil// <-- this may overflowcaseuint16:
returnint16(s), nil// <-- this may overflowcaseuint8:
returnint16(s), nilcasefloat64:
returnint16(s), nil// <-- this may overflowcasefloat32:
returnint16(s), nil// <-- this may overflow
You clam your library to be "safe casting from one type to another in Go", but in the code there are no checks for overflow when casting integer types:
Adding bounds check like this: https://play.golang.org/p/Jgu2NYg1qi3 would solve the issue.
The text was updated successfully, but these errors were encountered: