folly/Traits.h: fix a deep problem with FBVector
Summary: This started when many fbvector-related tests began failing with reports of ASAN-detected heap abuse (usually invalid free of an address 16 bytes into an already-freed buffer). It was very specific, though. The bug struck only when: - gcc-5-based platform - compiling with clang (~3.8) and GCC5's libstdc++, not gcc - strings were short enough to reside within an in-situ std::string Why? because FBVector.h:1588's conditional: if (folly::IsRelocatable<T>::value && usingStdAllocator::value) { was true for clang (erroneously), but false for gcc. The difference was in `IsRelocatable<std::string>::value`. However, manual tests showed that each component from the definition of `IsRelocatable` were the same for both gcc and clang. Then Jay Feldblum realized that we'd probably specialized that trait for `std::string`, and sure enough, I found the culprit: ``` FOLLY_ASSUME_FBVECTOR_COMPATIBLE_3(std::basic_string) ``` Reviewed By: pixelb Differential Revision: D4414159 fbshipit-source-id: 60e3fb4b096ec77cbd2b48c561e5c6ec8f128fff
Showing
Please register or sign in to comment