[SERVER-59346] Coverity analysis defect 120377: Bad bit shift operation Created: 16/Aug/21  Updated: 29/Oct/23  Resolved: 20/Aug/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Luke Bhan (Inactive)
Resolution: Fixed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2021-08-23, Execution Team 2021-09-06
Participants:

 Description   

Bad bit shift operation

The operation may have an undefined behavior or yield an unexpected result. A bit shift operation has a shift amount which is too large or has a negative value.
/src/mongo/bson/util/simple8b.cpp:422: BAD_SHIFT 120377 Checking "trailingZerosCount == 124" implies that "trailingZerosCount" is 124 on the true branch.
/src/mongo/bson/util/simple8b.cpp:423: BAD_SHIFT 120377 In expression "value >> trailingZerosCount", right shifting by more than 63 bits has undefined behavior. The shift amount, "trailingZerosCount", is 124.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 20/Aug/21 ]

Author:

{'name': 'lukebhan', 'email': 'luke.bhan@vanderbilt.edu', 'username': 'lukebhan'}

Message: SERVER-59346 Change to handle int128t cases for simple8b
Branch: master
https://github.com/mongodb/mongo/commit/6865365ee1761d00b76097e01748cbe35ec2df48

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