4444// The maximum number of topic criteria allowed, vm.LOG4 - vm.LOG0
4545const maxTopics = 4
4646
47+ // The maximum number of allowed topics within a topic criteria
48+ const maxSubTopics = 1000
49+
4750// filter is a helper struct that holds meta information over the filter type
4851// and associated subscription in the event system.
4952type filter struct {
@@ -620,7 +623,6 @@ func (args *TxFilterCriteria) UnmarshalJSON(data []byte) error {
620623 // data is an array consisting of strings.
621624 // JSON null values are converted to common.Hash{} and ignored by the filter manager.
622625 if len (raw .SigHashes ) > 0 {
623-
624626 parsed , err := decodeSigHashes (raw .SigHashes )
625627 if err != nil {
626628 return err
@@ -694,6 +696,10 @@ func decodeTopics(input []interface{}) ([][]common.Hash, error) {
694696 return nil , nil
695697 }
696698
699+ if len (input ) > maxTopics {
700+ return nil , errExceedMaxTopics
701+ }
702+
697703 result := make ([][]common.Hash , len (input ))
698704
699705 for i , t := range input {
@@ -711,6 +717,9 @@ func decodeTopics(input []interface{}) ([][]common.Hash, error) {
711717
712718 case []interface {}:
713719 // or case e.g. [null, "topic0", "topic1"]
720+ if len (topic ) > maxSubTopics {
721+ return nil , errExceedMaxTopics
722+ }
714723 for _ , rawTopic := range topic {
715724 if rawTopic == nil {
716725 // null component, match all
0 commit comments