You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/09/25 20:05:06 UTC

[GitHub] apeforest commented on a change in pull request #12631: WIP: [MXNET-953] Fix oob memory read

apeforest commented on a change in pull request #12631: WIP: [MXNET-953] Fix oob memory read
URL: https://github.com/apache/incubator-mxnet/pull/12631#discussion_r220335881
 
 

 ##########
 File path: 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<int64_t*>(out_data.dptr_) = in_data.Size();
 
 Review comment:
   uint32_t is currently used for index_t in mshadow. I have another PR to change index_t type from uint32_t to int64_t. Please see https://github.com/dmlc/mshadow/pull/348 and https://github.com/apache/incubator-mxnet/pull/11742 for more details

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services