-
Notifications
You must be signed in to change notification settings - Fork 947
Fix incorrect buffer index failure #3235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix incorrect buffer index failure #3235
Conversation
|
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
I squashed the commit messages, fixed the style and added end-of-line symbols, just in case. Some MicroPrintf() calls in micro_allocator.cc have them, some not. Let me know if you want me to add/remove them for all MicroPrintf() calls it in all the project in a unified way. If you allow, I will fix #3071, #3072, #3073, #3074, #3128and #2721. Let me know if this is OK (or what other things I can be useful for). PS. While trying to run the CI/CD tests I ran into some errors. I described them here #3240. If this is a bug, I can push the patch for it. |
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.