From 4cc746cfd430c45107cdbe355db65c828614a8a1 Mon Sep 17 00:00:00 2001 From: sabdenovch Date: Mon, 20 Apr 2026 10:26:29 +0300 Subject: Poison memory in allocation holders commit_hash:0912d7a08b0b2ae26b6298108a9fdd57cabbc77a --- library/cpp/yt/memory/ref.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'library/cpp/yt') diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp index 5a6ca1e3373..1743680b581 100644 --- a/library/cpp/yt/memory/ref.cpp +++ b/library/cpp/yt/memory/ref.cpp @@ -3,6 +3,7 @@ #include "blob.h" #include +#include #include @@ -99,6 +100,7 @@ class TAllocationHolderBase public: ~TAllocationHolderBase() { + PoisonFreedMemory(GetRef()); #ifdef YT_ENABLE_REF_COUNTED_TRACKING TRefCountedTrackerFacade::FreeTagInstance(Cookie_); TRefCountedTrackerFacade::FreeSpace(Cookie_, Size_); @@ -129,6 +131,8 @@ protected: #endif if (options.InitializeStorage) { ::memset(static_cast(this)->GetBegin(), 0, Size_); + } else { + PoisonUninitializedMemory(GetRef()); } #ifdef YT_ENABLE_REF_COUNTED_TRACKING TRefCountedTrackerFacade::AllocateTagInstance(Cookie_); -- cgit v1.3