[CXX-50] Remove undefined behavior w.r.t. unaligned memory accesses from bson headers Created: 18/Feb/14 Updated: 23/Oct/14 Resolved: 03/Oct/14 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | Portability |
| Affects Version/s: | None |
| Fix Version/s: | legacy-1.0.0-rc1 |
| Type: | Improvement | Priority: | Critical - P2 |
| Reporter: | Andrew Morrow (Inactive) | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | legacy-cxx | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The BSON headers (and some others) currently read and write arbitrary memory locations casted to types with alignment requirements. This is undefined behavior, and is non-portable to some architectures. We should replace these unaligned accesses with suitable memcpy calls, and trust in compiler QoI to turn those memcpy calls into intrinsics when applicable on the target platform. |
| Comments |
| Comment by Andrew Morrow (Inactive) [ 01/Oct/14 ] |