base58: fix decoding issue

This commit is contained in:
Oliver Gugger 2022-11-18 20:55:50 +01:00
parent 4350859a7b
commit 866b3dc0a3
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
2 changed files with 6 additions and 0 deletions

View File

@ -55,6 +55,10 @@ func Decode(b string) []byte {
total := uint64(0)
for _, v := range t[:n] {
if v > 255 {
return []byte("")
}
tmp := b58[v]
if tmp == 255 {
return []byte("")

View File

@ -43,6 +43,8 @@ var invalidStringTests = []struct {
{"4kl8", ""},
{"0OIl", ""},
{"!@#$%^&*()-_=+~`", ""},
{"abcd\xd80", ""},
{"abcd\U000020BF", ""},
}
var hexTests = []struct {