[SERVER-15193] appendNum(bool) uses implementation specific behavior Created: 09/Sep/14  Updated: 25/Apr/16  Resolved: 20/Jan/15

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

Type: Bug Priority: Major - P3
Reporter: Adam Midvidy Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

In BufBuilder there is a method appendNum(bool) defined as such:

       void appendNum(bool j) {                                                                                                                                                                                                              
            *((bool*)grow(sizeof(bool))) = j;                                                                                                                                                                                                 
        }  

The C++ standard explicitly states that the size of a bool is implementation defined. This method should be removed or rewritten, and the codebase should be audited for any uses of it.



 Comments   
Comment by Andrew Morrow (Inactive) [ 20/Jan/15 ]

This was fixed in commit c776c66 for SERVER-15174 in 2.7.7.

Generated at Thu Feb 08 03:37:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.