This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch 5.3.x
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit a5383f0751b042eaeb3bf3f0719cf11a8b0f5631
Author: Hyeonho Kim <[email protected]>
AuthorDate: Thu Oct 15 00:01:36 2026 +0900

    fix: Undefined behavior (#548)
    
    (cherry picked from commit ec8e9f4e3c, memory_operations.hpp only;
    the CI workflow change is not on 5.3.x)
---
 common/include/memory_operations.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/include/memory_operations.hpp 
b/common/include/memory_operations.hpp
index e5cc058d..0fab58a1 100644
--- a/common/include/memory_operations.hpp
+++ b/common/include/memory_operations.hpp
@@ -44,13 +44,13 @@ static inline void check_memory_size(size_t 
requested_index, size_t capacity) {
 
 // note: size is in bytes, not items
 static inline size_t copy_from_mem(const void* src, void* dst, size_t size) {
-  memcpy(dst, src, size);
+  if (size > 0) memcpy(dst, src, size);
   return size;
 }
 
 // note: size is in bytes, not items
 static inline size_t copy_to_mem(const void* src, void* dst, size_t size) {
-  memcpy(dst, src, size);
+  if (size > 0) memcpy(dst, src, size);
   return size;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to