We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
With current dev:
$ go run main.go $ tinygo run main.go $ tinygo run -target wasi main.go iban: invalid check digit $ cat main.go package main import "github.com/jbub/banking/iban" func main() { _, err := iban.New("AL50134113214854624345996786") if err != nil { println(err.Error()) } }
The text was updated successfully, but these errors were encountered:
I'll take a look at this tonight.
Sorry, something went wrong.
The iban validation code has an integer overflow. On native, int == int64, but wasi is a 32-bit platform, so int == int32.
int
int64
int32
Upstream can be patched with:
// https://en.wikipedia.org/wiki/International_Bank_Account_Number#Modulo_operation_on_IBAN func calculateMod(value string, code string) (int, error) { - var total int + var total int64 for _, c := range reformatIban(value, code) { - n := codepointToNum(int(c)) + n := int64(codepointToNum(int(c))) if n < 0 || n > 35 { return 0, ErrInvalidIbanModulo } @@ -102,7 +108,7 @@ func calculateMod(value string, code string) (int, error) { total %= modValue } } - return total % modValue, nil + return int(total % modValue), nil }
No branches or pull requests
With current dev:
The text was updated successfully, but these errors were encountered: