Skip to content

Commit 0a06c95

Browse files
committed
check utf8 string in GetFeeQuoterTokenUpdates
1 parent 8caef18 commit 0a06c95

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/ccip/chainaccessor/ton_accessor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"math/big"
1010
"sync"
1111
"time"
12+
"unicode/utf8"
1213

1314
"github.com/xssnick/tonutils-go/address"
1415
"github.com/xssnick/tonutils-go/tlb"
@@ -263,7 +264,7 @@ func (a *TONAccessor) LatestMessageTo(ctx context.Context, dest ccipocr3.ChainSe
263264
SkipBytes(40). // Skip to DestChainSelector
264265
FilterBytes(8, query.EQ(binary.BigEndian.AppendUint64(nil, uint64(dest)))).
265266
OrderBy(query.SortByTxLT, query.DESC). // sort by transaction LT new to old
266-
Limit(1). // only get the last one
267+
Limit(1). // only get the last one
267268
Execute(ctx, a.logPoller.GetStore())
268269

269270
if err != nil {
@@ -774,6 +775,9 @@ func (a *TONAccessor) GetFeeQuoterTokenUpdates(
774775
default:
775776
return nil, fmt.Errorf("expected either cell or nil, received %T", priceResult)
776777
}
778+
if !utf8.ValidString(token.String()) {
779+
return nil, fmt.Errorf("gRPC can't handle non-UTF8 strings: %x", token)
780+
}
777781
prices[ccipocr3.UnknownEncodedAddress(token)] = price
778782
}
779783
return prices, nil

0 commit comments

Comments
 (0)