From 74845ef4aa4c9d585515ee66595595dbd59b5e9e Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Thu, 5 Dec 2024 21:14:01 -0500 Subject: [PATCH] ci: address sanitizer issues (cherry picked from commit 584f9663216d6aea9985fb04f7093f04378a543c) --- source/adios2/helper/adiosType.h | 2 +- source/adios2/toolkit/format/bp/bp3/BP3Serializer.tcc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/adios2/helper/adiosType.h b/source/adios2/helper/adiosType.h index 24f360d524..1a52f89332 100644 --- a/source/adios2/helper/adiosType.h +++ b/source/adios2/helper/adiosType.h @@ -143,7 +143,7 @@ class CoreDims class DimsArray : public CoreDims { private: - size_t Dimensions[MAX_DIMS]; + size_t Dimensions[MAX_DIMS]{0}; public: // constructor with no init of values diff --git a/source/adios2/toolkit/format/bp/bp3/BP3Serializer.tcc b/source/adios2/toolkit/format/bp/bp3/BP3Serializer.tcc index d666955bd1..cc3eb86599 100644 --- a/source/adios2/toolkit/format/bp/bp3/BP3Serializer.tcc +++ b/source/adios2/toolkit/format/bp/bp3/BP3Serializer.tcc @@ -128,8 +128,9 @@ void BP3Serializer::PutSpanMetadata(const core::Variable &variable, const size_t minPosition = span.m_MinMaxMetadataPositions.first; const size_t maxPosition = span.m_MinMaxMetadataPositions.second; - std::copy(&min, &min + 1, reinterpret_cast(buffer.data() + minPosition)); - std::copy(&max, &max + 1, reinterpret_cast(buffer.data() + maxPosition)); + + std::memcpy(buffer.data() + minPosition, &min, sizeof(T)); + std::memcpy(buffer.data() + maxPosition, &max, sizeof(T)); } }