Skip to content

fix: validate tensor indices against subgraph bounds in MarkAllocationLifetimes#3591

Open
arunmanni-ai wants to merge 1 commit into
tensorflow:mainfrom
arunmanni-ai:fix/validate-tensor-indices-in-allocation
Open

fix: validate tensor indices against subgraph bounds in MarkAllocationLifetimes#3591
arunmanni-ai wants to merge 1 commit into
tensorflow:mainfrom
arunmanni-ai:fix/validate-tensor-indices-in-allocation

Conversation

@arunmanni-ai

@arunmanni-ai arunmanni-ai commented Jun 8, 2026

Copy link
Copy Markdown

Add bounds checks for tensor indices read from the model flatbuffer
in MarkAllocationLifetimes(). Tensor indices from operator inputs,
operator outputs, subgraph inputs, and subgraph outputs are now
validated against subgraph->tensors()->size() before use as array
indices. Returns kTfLiteError with a descriptive message on violation.

Mirrors the validation in tensorflow/lite/core/subgraph.cc added
for CVE-2020-15211, which was not present in the TFLM equivalent.

BUG=none

Refrence= issue tracker [521142176]

Add bounds checks for all tensor indices read from the model flatbuffer
in MarkAllocationLifetimes(). Out-of-bounds tensor indices cause direct
array access into subgraph_allocation_info[] without validation,
triggerable by a crafted model.

Validates each index against subgraph->tensors()->size() and returns
kTfLiteError on violation. Mirrors the fix in
tensorflow/lite/core/subgraph.cc for CVE-2020-15211, which was never
applied to the TFLM equivalent.

BUG=none
@arunmanni-ai arunmanni-ai requested a review from a team as a code owner June 8, 2026 07:13
@arunmanni-ai

Copy link
Copy Markdown
Author

@veblush — Could you review or assign this PR for code owner review?

This fixes CVE-2020-15211, which has been unfixed in TFLM since 2020. The change mirrors the validation already applied to tensorflow/lite/core/subgraph.cc but was missing from the TFLM equivalent.

The fix is a single bounds check in MarkAllocationLifetimes. All checks pass (tests, CLA, GitHub Actions).

Google Issue Tracker Reference: [521142176]

Happy to address any feedback immediately once assigned.

Thanks,
Arun

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