Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server/etcdserver: fix oss-fuzz issue #13700

Merged
merged 2 commits into from
Mar 1, 2022
Merged

Conversation

AdamKorcz
Copy link
Contributor

Fixes https://oss-fuzz.com/testcase-detail/6750173361995776.

(Oss-fuzz issue ID has not yet been assigned)

@@ -123,6 +124,9 @@ 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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about panic here.

Valid utf8 is just required to report metric. In normal code flow r.Method value that is not standard HTTP method (also not valid utf8) will result in ErrUnknownMethod being returned.

Problem happens when we want to report metrics about it. As it is already invalid request, maybe it's reasonable to just skip reporting metric?

Other approach would be to check if this whole code can be deleted. For the next release we are removing all V2 API. As this file is called apply_v2.go we should check if it's still called.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdamKorcz also, isn't such a check impacts other places in the code? e.g. references to r.Method in different files, and in general.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdamKorcz ^^ :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up @spzala, I will look into that this week.

Copy link
Member

@serathius serathius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-commenter
Copy link

Codecov Report

Merging #13700 (0672d43) into main (aa75fd0) will decrease coverage by 0.21%.
The diff coverage is 0.00%.

❗ Current head 0672d43 differs from pull request most recent head 5649cf3. Consider uploading reports for the commit 5649cf3 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13700      +/-   ##
==========================================
- Coverage   72.82%   72.61%   -0.22%     
==========================================
  Files         465      465              
  Lines       37880    37882       +2     
==========================================
- Hits        27588    27508      -80     
- Misses       8517     8588      +71     
- Partials     1775     1786      +11     
Flag Coverage Δ
all 72.61% <0.00%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/etcdserver/apply_v2.go 84.00% <0.00%> (-3.68%) ⬇️
server/etcdserver/api/rafthttp/peer_status.go 87.87% <0.00%> (-12.13%) ⬇️
server/auth/simple_token.go 80.00% <0.00%> (-8.47%) ⬇️
server/etcdserver/api/rafthttp/peer.go 87.01% <0.00%> (-8.45%) ⬇️
client/v3/concurrency/mutex.go 61.64% <0.00%> (-5.48%) ⬇️
server/etcdserver/api/v3rpc/watch.go 83.55% <0.00%> (-4.37%) ⬇️
server/etcdserver/api/v3rpc/member.go 93.54% <0.00%> (-3.23%) ⬇️
client/pkg/v3/testutil/leak.go 67.25% <0.00%> (-2.66%) ⬇️
server/etcdserver/api/rafthttp/msgappv2_codec.go 71.30% <0.00%> (-1.74%) ⬇️
client/pkg/v3/transport/listener_tls.go 50.81% <0.00%> (-1.63%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa75fd0...5649cf3. Read the comment docs.

@serathius serathius merged commit 1406a99 into etcd-io:main Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants