Skip to content

Commit

Permalink
Merge pull request #13700 from AdamKorcz/fuzz8
Browse files Browse the repository at this point in the history
server/etcdserver: fix oss-fuzz issue
  • Loading branch information
serathius committed Mar 1, 2022
2 parents fb55910 + 5649cf3 commit 1406a99
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/etcdserver/apply_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"path"
"strconv"
"time"
"unicode/utf8"

"github.com/coreos/go-semver/semver"
"go.etcd.io/etcd/pkg/v3/pbutil"
Expand Down Expand Up @@ -123,6 +124,10 @@ func (s *EtcdServer) applyV2Request(r *RequestV2, shouldApplyV3 membership.Shoul
alternative: func() string { return fmt.Sprintf("id:%d,method:%s,path:%s", r.ID, r.Method, r.Path) },
}
defer func(start time.Time) {
if !utf8.ValidString(r.Method) {
s.lg.Info("method is not valid utf-8")
return
}
success := resp.Err == nil
applySec.WithLabelValues(v2Version, r.Method, strconv.FormatBool(success)).Observe(time.Since(start).Seconds())
warnOfExpensiveRequest(s.Logger(), s.Cfg.WarningApplyDuration, start, stringer, nil, nil)
Expand Down

0 comments on commit 1406a99

Please sign in to comment.