From 111d939940b4fc475069a68c5a745f5b26ca92bd Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 25 Apr 2023 21:32:22 +0200 Subject: [PATCH] assign2: guard against self-assignment / overlapping openArray (#182) --- stew/assign2.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stew/assign2.nim b/stew/assign2.nim index cc8ecad..5e34cf9 100644 --- a/stew/assign2.nim +++ b/stew/assign2.nim @@ -15,7 +15,7 @@ func assignImpl[T](tgt: var openArray[T], src: openArray[T]) = mixin assign when supportsCopyMem(T): if tgt.len > 0: - copyMem(addr tgt[0], unsafeAddr src[0], sizeof(tgt[0]) * tgt.len) + moveMem(addr tgt[0], unsafeAddr src[0], sizeof(tgt[0]) * tgt.len) else: for i in 0..