Skip to content

Commit bc9c546

Browse files
Prevent heap oob access in resource_variable_ops.cc
PiperOrigin-RevId: 387936433 Change-Id: I9e71ddaa8dbd51ec6afbf163a6b3b591f193b4f6
1 parent d5f28c9 commit bc9c546

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tensorflow/core/kernels/resource_variable_ops.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,11 @@ class ResourceGatherOp : public OpKernel {
660660
OP_REQUIRES(
661661
c, TensorShapeUtils::IsVectorOrHigher(params.shape()),
662662
errors::InvalidArgument("params must be at least 1 dimensional"));
663+
OP_REQUIRES(
664+
c, params.shape().dims() >= batch_dims_,
665+
errors::InvalidArgument("params must have at least ", batch_dims_,
666+
" (batch_dims) dimensions but it has shape ",
667+
params.shape().DebugString()));
663668

664669
// Check that we have enough index space
665670
const int64_t N = indices.NumElements();

0 commit comments

Comments
 (0)