Skip to content

Check null compile_specs in delegate init#18805

Merged
lucylq merged 1 commit intomainfrom
security38
Apr 14, 2026
Merged

Check null compile_specs in delegate init#18805
lucylq merged 1 commit intomainfrom
security38

Conversation

@lucylq
Copy link
Copy Markdown
Contributor

@lucylq lucylq commented Apr 10, 2026

The FlatBuffer schema defines compile_specs as optional, but the code unconditionally dereferenced it. Add a null check so delegates without compile_specs get initialized with an empty spec list instead of crashing.

This PR was authored with the assistance of Claude.

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 10, 2026

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (4 Unrelated Failures)

As of commit c064deb with merge base 5e8a0df (image):

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

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 Apr 10, 2026
@github-actions
Copy link
Copy Markdown

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.

@lucylq lucylq changed the title Guard BackendDelegate::Init against null compile_specs Check null compile_specs in delegate init Apr 10, 2026
@lucylq lucylq marked this pull request as ready for review April 10, 2026 18:25
@lucylq lucylq requested a review from JacobSzwejbka as a code owner April 10, 2026 18:25
Copilot AI review requested due to automatic review settings April 10, 2026 18:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash during backend delegate initialization when the FlatBuffer compile_specs field is absent (optional in schema) by treating it as an empty compile spec list.

Changes:

  • Add a null check for delegate.compile_specs() before populating and sizing compile specs.
  • Default to compile_specs = nullptr and num_compile_specs = 0 so backends receive an empty ArrayRef<CompileSpec> when unspecified.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runtime/executor/method.cpp
The FlatBuffer schema defines compile_specs as optional, but the code
unconditionally dereferenced it. Add a null check so delegates without
compile_specs get initialized with an empty spec list instead of
crashing.

Addresses TOB-EXECUTORCH-38.

This PR was authored with the assistance of Claude.
@lucylq lucylq merged commit 7761476 into main Apr 14, 2026
163 of 167 checks passed
@lucylq lucylq deleted the security38 branch April 14, 2026 23:45
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.

3 participants