Fix incorrect buffer index failure#3235
Open
ilya-kupchenko wants to merge 2 commits intotensorflow:mainfrom
Open
Fix incorrect buffer index failure#3235ilya-kupchenko wants to merge 2 commits intotensorflow:mainfrom
ilya-kupchenko wants to merge 2 commits intotensorflow:mainfrom
Conversation
Contributor
Author
|
Hi, this is one of my first PRs. Sorry if anything is wrong (I tried my best). I added the validators for subgraph and tensor indices in MicroAllocator::PopulateTfLiteTensorFromFlatbuffer. I am not sure if this is needed and I am not sure about this: I have heard that "-1" is used sometimes to indicate optional tensors or lacking dimensions, not sure if this should be caught as well. Contributing on TFLM project was my dream, sorry if I did anything wrong. |
gonnet
requested changes
Oct 20, 2025
Contributor
gonnet
left a comment
There was a problem hiding this comment.
Thank you for fixing this!
…rs and subgraphs. Support for DECODE operator (tensorflow#3162) * Support for DECODE operator @tensorflow/micro Add initial support for DECODE operator. Add reference implementation. Add LUT decompression support. Update op resolvers. Update Makefiles and Bazel BUILD files. Add kernel unit test. bug=fixes tensorflow#3131 * update copyright * Don't use constructors with global objects (bluepill will not call them). Cleanup unit test. * Support for DECODE operator @tensorflow/micro Additional support for DECODE operator. Add Xtensa optimizations for LUT decompression. Move all Xtensa kernel source references to the Xtensa target makefile. bug=fixes tensorflow#3150 * Updates to Xtensa makefiles @tensorflow/micro Reorganize Xtensa makefiles such that all references to optimized kernel sources are moved to the Xtensa target makefile. Move hifimini kernel sources to the parent directory, and rename them so they do not interfere with the target overlay mechanism of the root makefile. bug=fixes tensorflow#3153 * Fix incorrect include path. Fix code style errors. * fix copyright * update generic benchmark op resolver size * Support for DECODE operator @tensorflow/micro Add reference implementation of pruning to DECODE operator. Makefile and Bazel BUILD file changes. Additional unit tests. bug=fixes tensorflow#3161 * Split decode tests into seperate files. Update pruning code with zero-point checks. Add const-tensor checks. * Add decode_test_helpers.h file. Cleanup tests. Added end-of-line symbols
40aedca to
3d81290
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
bug=fixes #3075 #3076 #3077
Problem
MicroAllocator does not validate the buffer indices. If a model provides an out-of-bounds buffer index for an input, output, or intermediate tensor, it results in segmentation fault.
Solution
Add validation inside MicroAllocator to check that the buffer index for every tensor. If an invalid index is found, InitializeTfLiteTensorFromFlatbuffer and InitializeTfLiteEvalTensorFromFlatbuffer will now return kTfLiteError.
Files Modified
tensorflow/lite/micro/micro_interpreter.cc
tensorflow/lite/micro/micro_interpreter_test.cc
Testing
Added new Bazel tests that use models with invalid buffer-to-tensor mappings.