[SERVER-75883] Coverity analysis defect 137567: Macro compares unsigned to 0 Created: 09/Apr/23  Updated: 29/Oct/23  Resolved: 18/Apr/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0, 7.0.0-rc1

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

Issue Links:
Backports
Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: QE 2023-05-01
Participants:

 Description   

Macro compares unsigned to 0

An unsigned value can never be negative, so this test will always evaluate the same way. An unsigned value can never be less than 0
/src/mongo/util/indexed_string_vector.h:139: NO_EFFECT 137567 This less-than-zero comparison of an unsigned value is never true. "encodedIdx < 0UL".



 Comments   
Comment by Githook User [ 10/May/23 ]

Author:

{'name': 'Drew Paroski', 'email': 'drew.paroski@mongodb.com', 'username': 'paroski'}

Message: SERVER-75883 Fix comparison in IndexedStringVector
Branch: v7.0
https://github.com/mongodb/mongo/commit/82deccec130f07d48befeb8fb5970cb8437f8687

Comment by Githook User [ 17/Apr/23 ]

Author:

{'name': 'Drew Paroski', 'email': 'drew.paroski@mongodb.com', 'username': 'paroski'}

Message: SERVER-75883 Fix comparison in IndexedStringVector
Branch: master
https://github.com/mongodb/mongo/commit/3d16ec3f4efce7f3bb8f0646b6afedd392b1b07c

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