KellenSunderland commented on a change in pull request #12631: [MXNET-953] Fix oob memory read URL: https://github.com/apache/incubator-mxnet/pull/12631#discussion_r220310625
########## 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: If we did that what would happen when the value was read elsewhere in code from dptr? My assumption here is we're treating the value other places as a int64_t. ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
