From ebd07bff1c7e1e664f126230f42b96a10c4c3456 Mon Sep 17 00:00:00 2001 From: Kellen Sunderland Date: Mon, 24 Sep 2018 23:08:38 -0700 Subject: [PATCH] [MXNET-953] Cast pointer to avoid OOB --- 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 3da9ff413294..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 int64_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)