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
panic: runtime error: index out of range [-1] [recovered]
panic: runtime error: index out of range [-1]
goroutine 19 [running]:
testing.tRunner.func1.2({0x1475040, 0xc000136288})
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1506 +0x24e
testing.tRunner.func1()
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1509 +0x39f
panic({0x1475040, 0xc000136288})
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/runtime/panic.go:884 +0x213
cosmossdk.io/math.precisionMultiplier(...)
/Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/math/dec.go:85
cosmossdk.io/math.LegacyNewDecWithPrec(0xa, 0xffffffffffffffff)
/Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/math/dec.go:97 +0xd9
cosmossdk.io/math.TestDecPrecision(0x0?)
/Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/math/panic_test.go:27 +0x25
testing.tRunner(0xc000103860, 0x14d2748)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1556 +0x10b
created by testing.(*T).Run
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/testing/testing.go:1603 +0x35f
exit status 2
Even though the validation is to panic, at least let's ensure it is intended as opposed to being unintended.
The text was updated successfully, but these errors were encountered:
… wrapping
Adds fuzzers for LegacyNewDecFromStr as well as a regression test
that requires some patches to have been made. While here, removed
unnecessary error wrapping.
Updates #14004Fixes#14251
Noticed in a security audit that this code for LegacyNewDec only checks that precision > LegacyPrecision
cosmos-sdk/math/dec.go
Lines 81 to 86 in 00ad3ec
but then blindly passes the value to index precisionMultipliers
Reproduction:
which panics with
Even though the validation is to panic, at least let's ensure it is intended as opposed to being unintended.
The text was updated successfully, but these errors were encountered: