diff options
author | Derek Mauro <dmauro@google.com> | 2023-08-01 10:33:06 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-01 10:34:10 -0700 |
commit | a4771dbd8a34980a6b41c595c1c07d1d0a1e1e2c (patch) | |
tree | 97039ee3006dd9dcbfc6b69d431713fc0b6b2cfc /absl | |
parent | 22091f4c0d6626b3ef40446ce3d4ccab19425ca3 (diff) |
InlinedVector: Disable CFI checking on the const GetInlinedData() path
as well. Some empty cases can trigger this.
See also:
https://clang.llvm.org/docs/ControlFlowIntegrity.html#bad-cast-checking.
PiperOrigin-RevId: 552846765
Change-Id: I6adb3c0c73efec841ffe8fdac4342f641c68ddbe
Diffstat (limited to 'absl')
-rw-r--r-- | absl/container/inlined_vector_test.cc | 6 | ||||
-rw-r--r-- | absl/container/internal/inlined_vector.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc index d9946b2a..b9a79f5b 100644 --- a/absl/container/inlined_vector_test.cc +++ b/absl/container/inlined_vector_test.cc @@ -1639,6 +1639,12 @@ TEST(DynamicVec, EmplaceBackAfterHeapAllocation) { EXPECT_EQ(v.size(), 1u); } +TEST(DynamicVec, EmptyIteratorComparison) { + DynamicVec v; + EXPECT_EQ(v.begin(), v.end()); + EXPECT_EQ(v.cbegin(), v.cend()); +} + TEST(AllocatorSupportTest, Constructors) { using MyAlloc = CountingAllocator<int>; using AllocVec = absl::InlinedVector<int, 4, MyAlloc>; diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h index cdfd868e..b2a602db 100644 --- a/absl/container/internal/inlined_vector.h +++ b/absl/container/internal/inlined_vector.h @@ -400,7 +400,7 @@ class Storage { return reinterpret_cast<Pointer<A>>(data_.inlined.inlined_data); } - ConstPointer<A> GetInlinedData() const { + ABSL_ATTRIBUTE_NO_SANITIZE_CFI ConstPointer<A> GetInlinedData() const { return reinterpret_cast<ConstPointer<A>>(data_.inlined.inlined_data); } |