golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.66k stars 1.58k forks source link

Coverity Scan - Logically dead code #1469

Closed raghvendra-dixit closed 1 year ago

raghvendra-dixit commented 1 year ago

What version of protobuf and what language are you using? Version: (e.g., v1.1.0, 89a0c16f, etc) google.golang.org/protobuf v1.26.0

What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good with .proto and .go source code.

What did you expect to see?

What did you see instead? Coverity scan report : Details:The indicated dead code may have performed some action; that action will never occur. In google.​golang.​org/protobuf/reflect/protodesc.​validateMessageDeclarations([]google.​golang.​org/protobuf/internal/filedesc.​Message, []*google.​golang.​org/protobuf/types/descriptorpb.​DescriptorProto, error): Code can never be reached because of a logical contradiction screenshot:

image

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment? go version 1.17 Image source for golang: us-docker.pkg.dev/google.com/api-project-999119582588/go-boringcrypto/golang:1.17.11b7

raghvendra-dixit commented 1 year ago

seems like this issue should be reported to different repo- i got confused with : https://github.com/protocolbuffers/protobuf-go/blob/master/reflect/protodesc/desc_validate.go

dsnet commented 1 year ago

This is right repo for the code you are looking at.

That code is intentionally dead for all public builds of protocol buffers. It is only active for Google's internal use of protocol buffers since they have to deal with legacy features that were removed before the open source of protocol buffers. You should be glad that it's dead.