Skip to content

Add bounds validation for FreeCall value_index in Method#18176

Draft
lucylq wants to merge 1 commit intomainfrom
security15
Draft

Add bounds validation for FreeCall value_index in Method#18176
lucylq wants to merge 1 commit intomainfrom
security15

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Mar 13, 2026

The FreeCall instruction handler directly indexes into values_ without bounds checking, enabling OOB memory access via malicious PTE files. This contrasts with JumpFalseCall which validates its index at init time, and MoveCall which uses bounds-checked accessors at execution time.

Add init-time validation for FreeCall matching the JumpFalseCall pattern, and switch execution-time access to use the bounds-checked mutable_value() accessor for defense in depth.

This PR was authored with the assistance of Claude.

The FreeCall instruction handler directly indexes into values_ without
bounds checking, enabling OOB memory access via malicious PTE files.
This contrasts with JumpFalseCall which validates its index at init time,
and MoveCall which uses bounds-checked accessors at execution time.

Add init-time validation for FreeCall matching the JumpFalseCall pattern,
and switch execution-time access to use the bounds-checked mutable_value()
accessor for defense in depth.

Addresses TOB-EXECUTORCH-15.

This PR was authored with the assistance of Claude.
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 13, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18176

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 1 Unrelated Failure

As of commit f9e7d86 with merge base 6c02866 (image):

NEW FAILURES - The following jobs have failed:

  • Lint / lintrunner (gh)
    >>> Lint for runtime/executor/method.cpp:
  • pull / test-binary-size-linux-gcc / linux-job (gh)
    /pytorch/executorch/kernels/portable/cpu/op_convolution.cpp:175:41: error: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 13, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant