From afefecfb17c78c87fb7e51ca917a0047df38253f Mon Sep 17 00:00:00 2001 From: Kellen Sunderland Date: Fri, 21 Sep 2018 09:01:50 -0700 Subject: [PATCH] [MXNET-953] Fix oob memory read --- src/operator/tensor/elemwise_unary_op_basic.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/operator/tensor/elemwise_unary_op_basic.cc b/src/operator/tensor/elemwise_unary_op_basic.cc index c3e9c2dc91d0..08636faa6fd9 100644 --- a/src/operator/tensor/elemwise_unary_op_basic.cc +++ b/src/operator/tensor/elemwise_unary_op_basic.cc @@ -542,8 +542,7 @@ void SizeComputeCPU(const nnvm::NodeAttrs& attrs, CHECK_EQ(req.size(), 1U); const TBlob& in_data = inputs[0]; const TBlob& out_data = outputs[0]; - const index_t size_var = in_data.Size(); - memcpy(out_data.dptr_, &size_var, 1U * sizeof(int64_t)); + *static_cast(out_data.dptr_) = in_data.Size(); } NNVM_REGISTER_OP(size_array)