Skip to content

Commit 9dc1f44

Browse files
committed
tensorflow/lite/kernels: Prevent an OOB read in expand_dims.cc
Signed-off-by: npt-1707 <[email protected]>
1 parent d1c5a6e commit 9dc1f44

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tensorflow/lite/kernels/expand_dims.cc

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ TfLiteStatus ExpandTensorDim(TfLiteContext* context, const TfLiteTensor& input,
3838
axis = input_dims.size + 1 + axis;
3939
}
4040
TF_LITE_ENSURE(context, axis <= input_dims.size);
41+
TF_LITE_ENSURE(context, axis >= 0);
4142

4243
TfLiteIntArray* output_dims = TfLiteIntArrayCreate(input_dims.size + 1);
4344
for (int i = 0; i < output_dims->size; ++i) {

0 commit comments

Comments
 (0)