|
|
|
@ -255,7 +255,7 @@ func toGoType(index int, t Type, output []byte) (interface{}, error) { |
|
|
|
|
|
|
|
|
|
// lengthPrefixPointsTo interprets a 32 byte slice as an offset and then determines which indices to look to decode the type.
|
|
|
|
|
func lengthPrefixPointsTo(index int, output []byte) (start int, length int, err error) { |
|
|
|
|
bigOffsetEnd := big.NewInt(0).SetBytes(output[index : index+32]) |
|
|
|
|
bigOffsetEnd := new(big.Int).SetBytes(output[index : index+32]) |
|
|
|
|
bigOffsetEnd.Add(bigOffsetEnd, common.Big32) |
|
|
|
|
outputLength := big.NewInt(int64(len(output))) |
|
|
|
|
|
|
|
|
@ -268,11 +268,9 @@ func lengthPrefixPointsTo(index int, output []byte) (start int, length int, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
offsetEnd := int(bigOffsetEnd.Uint64()) |
|
|
|
|
lengthBig := big.NewInt(0).SetBytes(output[offsetEnd-32 : offsetEnd]) |
|
|
|
|
lengthBig := new(big.Int).SetBytes(output[offsetEnd-32 : offsetEnd]) |
|
|
|
|
|
|
|
|
|
totalSize := big.NewInt(0) |
|
|
|
|
totalSize.Add(totalSize, bigOffsetEnd) |
|
|
|
|
totalSize.Add(totalSize, lengthBig) |
|
|
|
|
totalSize := new(big.Int).Add(bigOffsetEnd, lengthBig) |
|
|
|
|
if totalSize.BitLen() > 63 { |
|
|
|
|
return 0, 0, fmt.Errorf("abi: length larger than int64: %v", totalSize) |
|
|
|
|
} |
|
|
|
@ -287,7 +285,7 @@ func lengthPrefixPointsTo(index int, output []byte) (start int, length int, err |
|
|
|
|
|
|
|
|
|
// tuplePointsTo resolves the location reference for dynamic tuple.
|
|
|
|
|
func tuplePointsTo(index int, output []byte) (start int, err error) { |
|
|
|
|
offset := big.NewInt(0).SetBytes(output[index : index+32]) |
|
|
|
|
offset := new(big.Int).SetBytes(output[index : index+32]) |
|
|
|
|
outputLen := big.NewInt(int64(len(output))) |
|
|
|
|
|
|
|
|
|
if offset.Cmp(outputLen) > 0 { |
|
|
|
|