Skip to content

Commit

Permalink
fix(relayer): negative index check (#17615)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Jun 17, 2024
1 parent e077e11 commit 74e161a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/relayer/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func decodeDataAsERC20(decodedData []byte) (CanonicalToken, *big.Int, error) {
startIndex := offset.Int64() + canonicalTokenDataStartingindex*32

// Boundary check
if startIndex >= int64(len(decodedData)) {
if startIndex >= int64(len(decodedData)) || startIndex < 0 {
slog.Warn("startIndex greater than decodedData length",
"startIndex", startIndex,
"lenDecodedData", int64(len(decodedData)),
Expand Down Expand Up @@ -207,7 +207,7 @@ func decodeDataAsNFT(decodedData []byte) (EventType, CanonicalToken, *big.Int, e
startIndex := offset.Int64() + canonicalTokenDataStartingindex*32

// Boundary check
if startIndex >= int64(len(decodedData)) {
if startIndex >= int64(len(decodedData)) || startIndex < 0 {
slog.Warn("startIndex greater than decodedData length",
"startIndex", startIndex,
"lenDecodedData", int64(len(decodedData)),
Expand Down

0 comments on commit 74e161a

Please sign in to comment.