ugorji / go

idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]
MIT License
1.86k stars 295 forks source link

Coverity Scan - Logically dead code #379

Closed raghvendra-dixit closed 1 year ago

raghvendra-dixit commented 2 years ago

File : https://github.com/ugorji/go/blob/master/codec/encode.go Error - The indicated dead code may have performed some action; that action will never occur.

In github.​com/ugorji/go/codec.​Encoder.​encode(interface{}): Code can never be reached because of a logical contradiction (CWE-561)

Screenshot:

image
ugorji commented 1 year ago

This is not a valid bug. We treat uint and uint64 as different types, even if they end up being the same type. Consequently, we should check both, else we have to check first if running on 32 or 64 bit. At worst case, this is redundant. But it destroys the code to code around this check. Ignoring.