Skip to content

Commit

Permalink
Merge pull request #51269 from tensorflow/mm-cherrypick-b5cdbf12ffcaa…
Browse files Browse the repository at this point in the history
…ffecf98f22a6be5a64bb96e4f58-on-r2.3

Prevent overflow due to integer conversion to unsigned.
  • Loading branch information
mihaimaruseac committed Aug 5, 2021
2 parents 03f79c1 + 8bac83f commit 90ea9da
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tensorflow/core/kernels/non_max_suppression_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,8 @@ class CombinedNonMaxSuppressionOp : public OpKernel {
errors::InvalidArgument("max_size_per_class must be 0-D, got shape ",
max_output_size.shape().DebugString()));
const int max_size_per_class = max_output_size.scalar<int>()();
OP_REQUIRES(context, max_size_per_class > 0,
errors::InvalidArgument("max_size_per_class must be positive"));
// max_total_size: scalar
const Tensor& max_total_size = context->input(3);
OP_REQUIRES(
Expand Down

0 comments on commit 90ea9da

Please sign in to comment.