Merge pull request #50007 from geetachavan1/cherrypicks_IEK76

CherryPick2.2:Fix heap-buffer-overflow issue with tf.raw_ops.SparseFillEmptyRows.
This commit is contained in:
Mihai Maruseac 2021-06-02 18:09:46 -07:00 committed by GitHub
commit f3138b56e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,10 @@ class SparseFillEmptyRowsOp : public OpKernel {
default_value_t.shape().DebugString())); default_value_t.shape().DebugString()));
// TODO(ebrevdo): add shape checks between values, indices, // TODO(ebrevdo): add shape checks between values, indices,
// dense_shape. Also add check that dense rank > 0. // dense_shape. Also add check that dense rank > 0.
// Also add check that dense rank > 0.
OP_REQUIRES(context, dense_shape_t.NumElements() != 0,
errors::InvalidArgument("Dense shape cannot be empty."),
done);
const T& default_value = default_value_t.scalar<T>()(); const T& default_value = default_value_t.scalar<T>()();
const auto indices = indices_t.matrix<int64>(); const auto indices = indices_t.matrix<int64>();
const auto values = values_t.vec<T>(); const auto values = values_t.vec<T>();