From c26670cb1ac98244e0fcb5655a55603df52383c1 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 26 Sep 2024 01:06:13 -0700 Subject: [PATCH] Temporary enable flatbuffer verification assertion to investigate a crash on Windows. PiperOrigin-RevId: 679034841 --- .../compiler/mlir/lite/core/model_builder_base.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/mlir/lite/core/model_builder_base.h b/tensorflow/compiler/mlir/lite/core/model_builder_base.h index 3484f4e3d071d6..6856ac7260550c 100644 --- a/tensorflow/compiler/mlir/lite/core/model_builder_base.h +++ b/tensorflow/compiler/mlir/lite/core/model_builder_base.h @@ -386,9 +386,15 @@ class FlatBufferModelBase { size_t allocation_size = std::min(allocation->bytes(), static_cast(FLATBUFFERS_MAX_BUFFER_SIZE - 1)); + flatbuffers::Verifier::Options options; + // TODO(b/366118885): Remove after the root cause of the crash on Windows + // is found. +#if defined(_WIN32) + options.assert = true; +#endif flatbuffers::Verifier base_verifier( - reinterpret_cast(allocation->base()), - allocation_size); + reinterpret_cast(allocation->base()), allocation_size, + options); if (!VerifyModelBuffer(base_verifier)) { TF_LITE_REPORT_ERROR(error_reporter, "The model is not a valid Flatbuffer buffer");