From 0d45ea1ca641b21b73bcf9c00e0179cda284e7e7 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Tue, 27 Apr 2021 17:45:57 -0700 Subject: [PATCH] Prevent one more div by 0 in TFLite PiperOrigin-RevId: 370800114 Change-Id: I6b956aeb8c458cc6f514408d2e89ffacfe249e57 --- tensorflow/lite/kernels/space_to_depth.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow/lite/kernels/space_to_depth.cc b/tensorflow/lite/kernels/space_to_depth.cc index 4db7440b57e60..35a0fe1c26e20 100644 --- a/tensorflow/lite/kernels/space_to_depth.cc +++ b/tensorflow/lite/kernels/space_to_depth.cc @@ -61,6 +61,7 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type); const int block_size = params->block_size; + TF_LITE_ENSURE(context, block_size > 0); const int input_height = input->dims->data[1]; const int input_width = input->dims->data[2]; int output_height = input_height / block_size;