From 9dc1f44e9d6c6ec89d85c2535acffd893b70184e Mon Sep 17 00:00:00 2001 From: npt-1707 Date: Fri, 9 May 2025 03:48:31 +0800 Subject: [PATCH] tensorflow/lite/kernels: Prevent an OOB read in expand_dims.cc Signed-off-by: npt-1707 --- tensorflow/lite/kernels/expand_dims.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow/lite/kernels/expand_dims.cc b/tensorflow/lite/kernels/expand_dims.cc index 63b8b288cf9..214c2dd4124 100644 --- a/tensorflow/lite/kernels/expand_dims.cc +++ b/tensorflow/lite/kernels/expand_dims.cc @@ -38,6 +38,7 @@ TfLiteStatus ExpandTensorDim(TfLiteContext* context, const TfLiteTensor& input, axis = input_dims.size + 1 + axis; } TF_LITE_ENSURE(context, axis <= input_dims.size); + TF_LITE_ENSURE(context, axis >= 0); TfLiteIntArray* output_dims = TfLiteIntArrayCreate(input_dims.size + 1); for (int i = 0; i < output_dims->size; ++i) {