Skip to content

Commit

Permalink
Merge pull request #49815 from geetachavan1/cherrypicks_X3FU2
Browse files Browse the repository at this point in the history
Prevent array write out-of-bounds.
  • Loading branch information
mihaimaruseac committed May 27, 2021
2 parents a2c5283 + 904178c commit c427d9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tensorflow/lite/kernels/arg_min_max.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ TfLiteStatus ResizeOutput(TfLiteContext* context, const TfLiteTensor* input,
axis_value += NumDimensions(input);
}

TF_LITE_ENSURE(context, axis_value >= 0);
TF_LITE_ENSURE(context, axis_value < NumDimensions(input));

// Copy the input dimensions to output except the axis dimension.
TfLiteIntArray* output_dims = TfLiteIntArrayCreate(NumDimensions(input) - 1);
int j = 0;
Expand Down

0 comments on commit c427d9b

Please sign in to comment.