[SERVER-23823] Coverity analysis defect 98553: Unsafe assignment operator Created: 20/Apr/16  Updated: 08/Jan/24  Resolved: 03/May/16

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

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

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 14 (05/13/16)
Participants:

 Description   

Assignment operator does not check for self-assignment

Defect 98553 (STATIC_C)
Checker SELF_ASSIGN (subcategory none)
File: /src/mongo/base/secure_allocator.h
Function mongo::SecureHandle<std::basic_string<char, std::char_traits<char>, mongo::SecureAllocator<char>>>::operator =(const mongo::SecureHandle<std::basic_string<char, std::char_traits<char>, mongo::SecureAllocator<char>>>&)
/src/mongo/base/secure_allocator.h, line: 229
No protection against the object assigning to itself.

                _t = _new(*other);



 Comments   
Comment by Mira Carey [ 03/May/16 ]

Not a bug. That branch involves self copy assigning a moved from object, which isn't valid to begin with. self copy assignment for non-moved from types will work if T is self copy assignable

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