25 lines
871 B
Diff
25 lines
871 B
Diff
|
|
From 5117e0851348065ed59c991562c0ec80d9193db2 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Mihai Maruseac <mihaimaruseac@google.com>
|
||
|
|
Date: Wed, 28 Apr 2021 16:16:56 -0700
|
||
|
|
Subject: [PATCH] Prevent a division by 0
|
||
|
|
|
||
|
|
---
|
||
|
|
tensorflow/lite/kernels/hashtable_lookup.cc | 1 +
|
||
|
|
1 file changed, 1 insertion(+)
|
||
|
|
|
||
|
|
diff --git a/tensorflow/lite/kernels/hashtable_lookup.cc b/tensorflow/lite/kernels/hashtable_lookup.cc
|
||
|
|
index 65e50fe4..9d947107 100644
|
||
|
|
--- a/tensorflow/lite/kernels/hashtable_lookup.cc
|
||
|
|
+++ b/tensorflow/lite/kernels/hashtable_lookup.cc
|
||
|
|
@@ -101,6 +101,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
|
||
|
|
const TfLiteTensor* value = GetInput(context, node, 2);
|
||
|
|
|
||
|
|
const int num_rows = SizeOfDimension(value, 0);
|
||
|
|
+ TF_LITE_ENSURE(context, num_rows != 0);
|
||
|
|
const int row_bytes = value->bytes / num_rows;
|
||
|
|
void* pointer = nullptr;
|
||
|
|
DynamicBuffer buf;
|
||
|
|
--
|
||
|
|
2.23.0
|
||
|
|
|