summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-07-27 08:44:56 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-07-27 08:45:43 -0700
commit8f4fcc62cf9b92680bed46655653f224190bfce3 (patch)
tree2e1e04f210fbce1cc0fcf1fc4b3ac4174612dca4 /absl
parent4ff6968df3833b11f9ab063675126b1562b8b73b (diff)
InlinedVector: Disable CFI checking during the reinterpret_cast on the
heap allocation path. The cast occurs before the memory is initialized. See also: https://clang.llvm.org/docs/ControlFlowIntegrity.html#bad-cast-checking. PiperOrigin-RevId: 551542366 Change-Id: Id5834892c36a5cb8ec095bcfee3e9e31f20c48ae
Diffstat (limited to 'absl')
-rw-r--r--absl/container/inlined_vector_test.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc
index 5acad650..d9946b2a 100644
--- a/absl/container/inlined_vector_test.cc
+++ b/absl/container/inlined_vector_test.cc
@@ -1632,6 +1632,13 @@ TEST(DynamicVec, EmplaceBack) {
EXPECT_EQ(v.size(), 1u);
}
+TEST(DynamicVec, EmplaceBackAfterHeapAllocation) {
+ DynamicVec v;
+ v.reserve(10);
+ v.emplace_back(Dynamic{});
+ EXPECT_EQ(v.size(), 1u);
+}
+
TEST(AllocatorSupportTest, Constructors) {
using MyAlloc = CountingAllocator<int>;
using AllocVec = absl::InlinedVector<int, 4, MyAlloc>;