[SERVER-50235] Coverity analysis defect 114560: Out-of-bounds read Created: 10/Aug/20  Updated: 27/Oct/23  Resolved: 03/Dec/20

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: None

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

Operating System: ALL
Sprint: Execution Team 2020-12-14
Participants:

 Description   

Out-of-bounds read

Incorrect values read from a different memory region will cause incorrect computations. Out-of-bounds read from a buffer
/src/mongo/db/storage/key_string.cpp:1183: OVERRUN 114560 Function call "mongo::countLeadingZeros64(value)" may return 64.
/src/mongo/db/storage/key_string.cpp:1183: OVERRUN 114560 Assigning: "bytesNeeded" = "(64 - mongo::countLeadingZeros64(value) + 7) / 8". The value of "bytesNeeded" is now 0.
/src/mongo/db/storage/key_string.cpp:1187: OVERRUN 114560 Assigning: "firstUsedByte" = "reinterpret_cast<char const *>(&value + 1) - bytesNeeded". "firstUsedByte" now points to byte 8 of "value" (which consists of 8 bytes).


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