Skip to content

Commit 8262daf

Browse files
authored
Merge pull request #189 from thirdweb-dev/np/decode_fix
check topic length before decode
2 parents 7421489 + 37d00a0 commit 8262daf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/common/log.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ func (l *Log) Decode(eventABI *abi.Event) *DecodedLog {
165165
}
166166

167167
func decodeIndexedArgument(argType abi.Type, topic string) (interface{}, error) {
168+
if len(topic) < 3 {
169+
return nil, fmt.Errorf("invalid topic %s", topic)
170+
}
168171
topicBytes := gethCommon.Hex2Bytes(topic[2:]) // Remove "0x" prefix
169172
switch argType.T {
170173
case abi.AddressTy:

0 commit comments

Comments
 (0)