[SERVER-44274] Coverity analysis defect 113947: Uninitialized scalar variable Created: 28/Oct/19  Updated: 29/Oct/23  Resolved: 28/Oct/19

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

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

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2019-11-04
Participants:

 Description   

Use of an uninitialized variable

Defect 113947 (STATIC_C)
Checker UNINIT (subcategory none)
File: /src/mongo/stdx/thread.h
Function mongo::stdx::support::SigAltStackController::_uninstall() const
/src/mongo/stdx/thread.h, line: 88
Declaring variable "ss" without initializer.

            stack_t ss;

/src/mongo/stdx/thread.h, line: 90
Using uninitialized value "ss". Field "ss.ss_sp" is uninitialized when calling "sigaltstack".

            if (sigaltstack(&ss, nullptr)) {



 Comments   
Comment by Githook User [ 28/Oct/19 ]

Author:

{'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}

Message: SERVER-44274 zero-initialize stack_t structure
Branch: master
https://github.com/mongodb/mongo/commit/3519a0af27978023333d26df6f3a921cbd189ca6

Comment by Billy Donahue [ 28/Oct/19 ]

http://mongodbcr.appspot.com/477670001

Comment by Billy Donahue [ 28/Oct/19 ]

Done. But I think I'll "fix" it anyway since it's easy to do.

Comment by Eric Milkie [ 28/Oct/19 ]

You can mark it False Positive in the interface.

Comment by Billy Donahue [ 28/Oct/19 ]

Well I’m sure this isn’t a defect. If the stack_t’s ss_flags field has a SS_DISABLE bit set, the other fields of the stack_t are ignored. This is spelled out in the POSIX spec for sigaltstack.

What do we do with false positives?

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