[PATCH] D12247: [libc++] remove possible trailing padding from aligned_storage
David Li via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 26 10:28:47 PDT 2015
davidxl added a subscriber: davidxl.
davidxl added a comment.
In libc++, placement new is used in many places. When selecting the buffer size for the placed object, it uses the 'actual' size of the buffer including the padding bytes from alignment, instead of the declared of the buffer. As a result, the declared buffer size may be smaller than the target object. Due to this mismatch, the compiler may see out of bound access of the buffer thus miscompile the program.
The purpose of the fix is to make the declared size == actual buffer size.
http://reviews.llvm.org/D12247
More information about the cfe-commits
mailing list