Skip to content

Commit

Permalink
InlinedVector: Disable CFI checking during the reinterpret_cast on the
Browse files Browse the repository at this point in the history
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
  • Loading branch information
derekmauro authored and Copybara-Service committed Jul 27, 2023
1 parent 4ff6968 commit 8f4fcc6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions absl/container/inlined_vector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down

0 comments on commit 8f4fcc6

Please sign in to comment.