mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
core/vm: remove shift
This commit is contained in:
parent
ae8d4d4629
commit
c8d18bf9c3
1 changed files with 8 additions and 11 deletions
|
|
@ -506,6 +506,7 @@ func (c *bigModExp) Run(input []byte) ([]byte, error) {
|
|||
baseLen = baseLenBig.Uint64()
|
||||
expLen = expLenBig.Uint64()
|
||||
modLen = modLenBig.Uint64()
|
||||
inputLenOverflow = max(baseLenBig.BitLen(), expLenBig.BitLen(), modLenBig.BitLen()) > 64
|
||||
)
|
||||
if len(input) > 96 {
|
||||
input = input[96:]
|
||||
|
|
@ -513,12 +514,8 @@ func (c *bigModExp) Run(input []byte) ([]byte, error) {
|
|||
input = input[:0]
|
||||
}
|
||||
|
||||
inputLensHighBitsSet := baseLenBig.Rsh(baseLenBig, 64).Cmp(common.Big0) != 0 ||
|
||||
expLenBig.Rsh(expLenBig, 64).Cmp(common.Big0) != 0 ||
|
||||
modLenBig.Rsh(modLenBig, 64).Cmp(common.Big0) != 0
|
||||
|
||||
// enforce size cap for inputs
|
||||
if c.eip7823 && (max(baseLen, expLen, modLen) > 1024 || inputLensHighBitsSet) {
|
||||
if c.eip7823 && (inputLenOverflow || max(baseLen, expLen, modLen) > 1024) {
|
||||
return nil, errors.New("one or more of base/exponent/modulus length exceeded 1024 bytes")
|
||||
}
|
||||
// Handle a special case when both the base and mod length is zero
|
||||
|
|
|
|||
Loading…
Reference in a new issue