Skip to content

Commit

Permalink
Merge pull request #1923 from guggero/base58-fix
Browse files Browse the repository at this point in the history
base58: fix decoding issue
  • Loading branch information
guggero committed Nov 18, 2022
2 parents 4350859 + 866b3dc commit 02c854e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions btcutil/base58/base58.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand Down
2 changes: 2 additions & 0 deletions btcutil/base58/base58_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ var invalidStringTests = []struct {
{"4kl8", ""},
{"0OIl", ""},
{"!@#$%^&*()-_=+~`", ""},
{"abcd\xd80", ""},
{"abcd\U000020BF", ""},
}

var hexTests = []struct {
Expand Down

0 comments on commit 02c854e

Please sign in to comment.