[SERVER-66828] Coverity analysis defect 122257: Misuse of memcmp-style function Created: 27/May/22  Updated: 29/Oct/23  Resolved: 27/May/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc8, 6.1.0-rc0

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

Attachments: PNG File Screen Shot 2022-05-27 at 8.48.19 AM.png    
Issue Links:
Backports
Problem/Incident
is caused by SERVER-66565 Create config.transactions partial in... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0
Sprint: Sharding NYC 2022-06-13
Participants:

 Description   

Misuse of memcmp-style function

The return value may be misinterpreted if the function returns an unexpected value. A memcmp-style function is used assuming that it returns -1, 0, or 1.
/src/mongo/db/transaction_participant.cpp:187: BAD_COMPARE 122257 The return value of "find" is not of the type boolean. Note that "find" returns the position of the start of the substring that matches the search criteria or std::string::npos if the search was unsuccessful.



 Comments   
Comment by Githook User [ 27/May/22 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-66828 Fix coverity defect

(cherry picked from commit 1bb4f64ef836c0c1a20955d8f6d559eaffe08563)
Branch: v6.0
https://github.com/mongodb/mongo/commit/3da01eeee8270960d88a71e434ea2ee9c0f04457

Comment by Githook User [ 27/May/22 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-66828 Fix coverity defect
Branch: master
https://github.com/mongodb/mongo/commit/1bb4f64ef836c0c1a20955d8f6d559eaffe08563

Comment by Kyle Suarez [ 27/May/22 ]

CC jack.mulrow@mongodb.com

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