openvino
bc2d62dc - [TFL FE] Validate Tensor.name presence to prevent null-ptr deref on malformed flatbuffer (#35607)

Commit
2 days ago
[TFL FE] Validate Tensor.name presence to prevent null-ptr deref on malformed flatbuffer (#35607) ### Details: In the TFLite FlatBuffer schema every table field is implicitly optional, so the schema-generated `Tensor::name()` accessor returns nullptr when the `name` slot is absent in the tensor's vtable. The frontend dereferenced the result without a guard at five sites in `decoder_flatbuffer.cpp`, crashing with SIGSEGV on structurally valid but malformed `.tflite` inputs (e.g. those produced by fuzzers). The buffer verifier (`tflite::VerifyModelBuffer`) accepts such inputs, since absent optional fields are legal flatbuffer semantics, so the check has to happen at the call sites that consume the field. This change centralises the dereference in a `safe_tensor_name()` helper that fails fast via `FRONT_END_GENERAL_CHECK` when the tensor pointer or the `name` field is null, and routes all five existing call sites through it. ## Changes - New `safe_tensor_name()` helper in the anonymous namespace of `src/frontends/tensorflow_lite/src/decoder_flatbuffer.cpp`. - Five call sites updated to use the helper: `extract_tensor_meta_info`, `DecoderFlatBuffer::get_input_node`, `get_input_tensor_name`, `get_output_tensor_name`, `decode_tensor`. - New flatbuffers-based generator `tests/test_models/gen_scripts/generate_malformed_tensor_name.py` that emits a minimal, schema-valid `.tflite` whose first tensor has no `name` slot in its vtable. - New parametrised regression case `MissingTensorName` under `MalformedModelLoadTest` in `tests/convert_unsupported.cpp`. The CMake `GLOB_RECURSE` over `generate_*.py` picks up the new generator with no CMake edit. ## Test plan - [x] `ov_tensorflow_lite_frontend_tests --gtest_filter='*Malformed*'` — all 17 cases pass, including the new `MissingTensorName/MalformedModelLoadTest.load_throws/0`. - [x] `ov_tensorflow_lite_frontend_tests` (with the suites that depend on fixtures from tensorflow-importing generators filtered out, due to a pre-existing Python 3.12 / wrapt issue in the build venv) — green. - [x] Crash reproducer (calling `ov::Core::read_model()` on the original fuzzer corpus input) now returns a clean `ov::Exception` with the diagnostic message instead of segfaulting. ### Tickets: - 183013
Author
Parents
Loading