[SERVER-59744] Cannot bit-shift a negative number in splitVector command Created: 02/Sep/21  Updated: 29/Oct/23  Resolved: 16/Sep/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: Dianna Hohensee (Inactive) Assignee: Pierlauro Sciarelli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding EMEA 2021-09-20
Participants:
Linked BF Score: 128

 Description   

jstestfuzz set a negative number for maxChunkSize in the splitVector command, which the command tries to bit shift left and runs into a runtime error. I think ensuring maxChunkSize is positive would fix the problem.

Might also consider max long long values, wherein bit shifting might exceed the max value? Calling BSONElement::safeNumberLong() ensures we handle out of bound values for maxChunkSize, but then the code bit-shifts it further.



 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 [ 16/Sep/21 ]

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: SERVER-59744 splitVector must never be invoked with negative chunk size
Branch: master
https://github.com/mongodb/mongo/commit/9caae4e9c3cc4c0dc27967ad9e0f84284087a8de

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