diff options
author | lukyan <lukyan@yandex-team.com> | 2024-12-04 13:14:05 +0300 |
---|---|---|
committer | lukyan <lukyan@yandex-team.com> | 2024-12-04 13:35:10 +0300 |
commit | 03079d84d628a7bae43b5ead6cddad4c11ea6fff (patch) | |
tree | 6096d8d0486d3b33b2540bd3c0f7e42b5417736e /library/cpp | |
parent | 2e229c177b8e374062c3fd82fca76cccec5ec16e (diff) | |
download | ydb-03079d84d628a7bae43b5ead6cddad4c11ea6fff.tar.gz |
YT-23698: Check size of ref counted objects
commit_hash:97159680fa733af4212c094e917bc78a47eb0c15
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/yt/memory/ref_counted-inl.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/library/cpp/yt/memory/ref_counted-inl.h b/library/cpp/yt/memory/ref_counted-inl.h index 6c20db8c41..923b53c822 100644 --- a/library/cpp/yt/memory/ref_counted-inl.h +++ b/library/cpp/yt/memory/ref_counted-inl.h @@ -149,6 +149,10 @@ struct TRefCountedTraits template <class T> struct TRefCountedTraits<T, true> { + static_assert( + sizeof(T) < (1ULL << PackedPtrTagBits), + "Ref counted object derived from TRefCountedBase exceedes max size"); + Y_FORCE_INLINE static const TRefCounter* GetRefCounter(const T* obj) { return obj; |