[SERVER-50030] Coverity analysis defect 115212: Wrong operator used Created: 30/Jul/20  Updated: 29/Oct/23  Resolved: 10/Aug/20

Status: Closed
Project: Core Server
Component/s: Catalog
Affects Version/s: None
Fix Version/s: 4.7.0, 4.4.2

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-42693 M/R Agg: Implement $_internalOutToDif... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Execution Team 2020-08-24
Participants:

 Description   

Wrong operator used

Inadvertent use of the wrong operator results in a likely logic error. Common interchanges include bit-or and bit-and, left-shift and right-shift. Wrong operator used in expression
/src/mongo/db/commands/dbcommands.cpp:356: CONSTANT_EXPRESSION_RESULT 115212 "opCtx->getClient()>session()>getTags() | 2U /* mongo::transport::Session::kInternalClient */" is always 1/true regardless of the values of its operand. This occurs as the logical second operand of "||".



 Comments   
Comment by Githook User [ 08/Sep/20 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-50030 Fix kInternalClient check in dbcommands.cpp

(cherry picked from commit 79ad90cee37d361085ff42ea3b07287edf787896)
Branch: v4.4
https://github.com/mongodb/mongo/commit/13ca4e18e78408dfc34270b7acfd63447bac1375

Comment by Githook User [ 10/Aug/20 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-50030 Fix kInternalClient check in dbcommands.cpp
Branch: master
https://github.com/mongodb/mongo/commit/79ad90cee37d361085ff42ea3b07287edf787896

Comment by Benety Goh [ 10/Aug/20 ]

This Coverity violation was introduced in SERVER-42693 (commit) to support a MapReduce improvement.

Generated at Thu Feb 08 05:21:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.