diff options
author | nadya73 <nadya73@yandex-team.com> | 2025-02-10 14:42:33 +0300 |
---|---|---|
committer | nadya73 <nadya73@yandex-team.com> | 2025-02-10 15:49:30 +0300 |
commit | 8647d4a864e1a79dc3ee8cbbf21ae3ce77072bbb (patch) | |
tree | 17d1c71af7880832927c1a9899e9225d6eb7ff71 /library/cpp | |
parent | 5079f75b9e1bdf35a019a79274547b338254846f (diff) | |
download | ydb-8647d4a864e1a79dc3ee8cbbf21ae3ce77072bbb.tar.gz |
Fix unaligned load/store UB in bus and zstd compression
commit_hash:55e574599005f5286f646ebba93d5550325708bc
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/yt/misc/unaligned-inl.h | 31 | ||||
-rw-r--r-- | library/cpp/yt/misc/unaligned.h | 23 |
2 files changed, 0 insertions, 54 deletions
diff --git a/library/cpp/yt/misc/unaligned-inl.h b/library/cpp/yt/misc/unaligned-inl.h deleted file mode 100644 index 68e1c9b499..0000000000 --- a/library/cpp/yt/misc/unaligned-inl.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef UNALIGNED_INL_H_ -#error "Direct inclusion of this file is not allowed, include unaligned.h" -// For the sake of sane code completion. -#include "unaligned.h" -#endif - -#include <cstring> - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - -template <class T> - requires std::is_trivial_v<T> -T UnalignedLoad(const T* ptr) -{ - T value; - std::memcpy(&value, ptr, sizeof(T)); - return value; -} - -template <class T> - requires std::is_trivial_v<T> -void UnalignedStore(T* ptr, const T& value) -{ - std::memcpy(ptr, &value, sizeof(T)); -} - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT diff --git a/library/cpp/yt/misc/unaligned.h b/library/cpp/yt/misc/unaligned.h deleted file mode 100644 index 68c124183f..0000000000 --- a/library/cpp/yt/misc/unaligned.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include <type_traits> - -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - -template <class T> - requires std::is_trivial_v<T> -T UnalignedLoad(const T* ptr); - -template <class T> - requires std::is_trivial_v<T> -void UnalignedStore(T* ptr, const T& value); - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace NYT - -#define UNALIGNED_INL_H_ -#include "unaligned-inl.h" -#undef UNALIGNED_INL_H_ |