From e131622ef79c583672bd8701e3d50b13174bcc09 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Tue, 22 Nov 2016 13:10:25 +0300 Subject: [PATCH] Use memmove() for potentially overlapping ranges. --- runtime/src/main/cpp/Arrays.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/main/cpp/Arrays.cpp b/runtime/src/main/cpp/Arrays.cpp index a661c8ae9aa..00769bcbc11 100644 --- a/runtime/src/main/cpp/Arrays.cpp +++ b/runtime/src/main/cpp/Arrays.cpp @@ -58,7 +58,7 @@ void Kotlin_Array_copyImpl(const ArrayHeader* array, KInt fromIndex, ThrowArrayIndexOutOfBoundsException(); } // TODO: refcounting! - memcpy(ArrayAddressOfElementAt(destination, toIndex), + memmove(ArrayAddressOfElementAt(destination, toIndex), ArrayAddressOfElementAt(array, fromIndex), count * sizeof(KRef)); }