Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r2.6 cherry-pick: 13d38a07ce9 "Fix tf.raw_ops.UnsortedSegmentJoin vulnerability with invalid num_segments." #55876

Merged
merged 1 commit into from May 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions tensorflow/core/kernels/unsorted_segment_join_op.cc
Expand Up @@ -92,6 +92,9 @@ class UnsortedSegmentJoinOp : public OpKernel {
const Tensor& num_segments_tensor = context->input(2);
OP_REQUIRES(context, num_segments_tensor.NumElements() != 0,
errors::InvalidArgument("Number of segments cannot be empty."));
OP_REQUIRES(context,
TensorShapeUtils::IsScalar(num_segments_tensor.shape()),
errors::InvalidArgument("Number of segments must be a scalar"));
auto num_segments = num_segments_tensor.scalar<NUM_SEGMENTS_TYPE>()();

OP_REQUIRES(context, segment_dims != 0,
Expand Down