Skip to content

Validate TFLite inputs before copying tensor data - #4148

Open
x-Spartacus wants to merge 1 commit into
tensorflow:masterfrom
x-Spartacus:tflite-input-validation
Open

x-Spartacus wants to merge 1 commit into
tensorflow:masterfrom
x-Spartacus:tflite-input-validation

Conversation

@x-Spartacus

Copy link
Copy Markdown

This change validates each request tensor against the corresponding TFLite model input before copying data. Requests are rejected when the dtype or byte count differs from the destination tensor. It also reacquires tensor pointers after AllocateTensors() and verifies that co-batched tasks use the same input count, model input indices, and output names.

Previously, the destination buffer was allocated using the model tensor type while the copy length came from the request tensor. A mismatched request dtype could therefore copy more data than the destination buffer can hold.

Testing:

  • bazel test //tensorflow_serving/servables/tensorflow:tflite_session_test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant