[Bug Fix] Using memmove for in-place calculation
authorjijoong.moon <jijoong.moon@samsung.com>
Tue, 5 Jun 2018 08:51:48 +0000 (17:51 +0900)
committer함명주/동작제어Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Tue, 5 Jun 2018 09:03:46 +0000 (18:03 +0900)
Sometimes there is undefined behavior when the source and destination overlaped.
In this case, we have to use memmove to handle overlapping regions.

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
tensor_converter/tensor_converter.c

index fb97660..01f3976 100644 (file)
@@ -528,7 +528,7 @@ static GstFlowReturn gst_tensor_converter_transform_ip(GstBaseTransform *trans,
         g_assert(d0 == 0);
         for (row = 0; row < filter->dimension[2]; row++) { // Height
          if (dest_idx != src_idx)
-           memcpy(ptr + dest_idx, ptr + src_idx, size);
+           memmove(ptr + dest_idx, ptr + src_idx, size);
          dest_idx += size;
          src_idx += offset;
        }