accounts/abi: avoid unnecessary alloc (#24128)

This commit is contained in:
Daniel Liu 2025-01-14 10:56:13 +08:00
parent b33307eaea
commit c5acd6822d

View file

@ -291,7 +291,7 @@ func tuplePointsTo(index int, output []byte) (start int, err error) {
offset := big.NewInt(0).SetBytes(output[index : index+32])
outputLen := big.NewInt(int64(len(output)))
if offset.Cmp(big.NewInt(int64(len(output)))) > 0 {
if offset.Cmp(outputLen) > 0 {
return 0, fmt.Errorf("abi: cannot marshal in to go slice: offset %v would go over slice boundary (len=%v)", offset, outputLen)
}
if offset.BitLen() > 63 {