Replace test with invalid-enum-load (#2546)
The TestTypeSizeOf was casting an invalid value for TfLiteType into a variable of that type. This is undefined behavior and triggered ubsan. This PR replaces this test case with using kTfLiteNoType, which will still trigger the default failure case for TfLiteTypeSizeOf.
BUG=b/333708102
diff --git a/tensorflow/lite/micro/memory_helpers_test.cc b/tensorflow/lite/micro/memory_helpers_test.cc
index e44c586..9da2940 100644
--- a/tensorflow/lite/micro/memory_helpers_test.cc
+++ b/tensorflow/lite/micro/memory_helpers_test.cc
@@ -180,8 +180,8 @@
tflite::TfLiteTypeSizeOf(kTfLiteComplex128, &size));
TF_LITE_MICRO_EXPECT_EQ(sizeof(double) * 2, size);
- TF_LITE_MICRO_EXPECT_NE(
- kTfLiteOk, tflite::TfLiteTypeSizeOf(static_cast<TfLiteType>(-1), &size));
+ TF_LITE_MICRO_EXPECT_NE(kTfLiteOk,
+ tflite::TfLiteTypeSizeOf(kTfLiteNoType, &size));
}
TF_LITE_MICRO_TEST(TestBytesRequiredForTensor) {