Conversation
…_externs Add null checks for flatbuffer_graph, xvalues(), and xnodes() after deserialization to prevent NULL pointer dereferences on malformed input. Validate num_externs does not exceed total number of values to prevent unbounded memory allocation in xnn_create_subgraph. Authored-with: Claude
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18799
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 2 New Failures, 1 Cancelled Job, 1 Unrelated FailureAs of commit 7b5b1b5 with merge base 21d9c64 ( NEW FAILURES - The following jobs have failed:
CANCELLED JOB - The following job was cancelled. Please retry:
BROKEN TRUNK - The following job failed but were 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. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
This PR hardens XNNPACK flatbuffer deserialization in XNNCompiler::compileModel by adding basic validation checks before the graph is consumed, reducing the risk of null dereferences on malformed inputs.
Changes:
- Add null checks for the deserialized flatbuffer graph and its
xvalues/xnodesvectors. - Add a consistency check ensuring
num_externs <= xvalues()->size()before creating the XNNPACK subgraph. - Use the validated
num_externsvalue when callingxnn_create_subgraph.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ET_CHECK_OR_RETURN_ERROR( | ||
| flatbuffer_graph != nullptr && flatbuffer_graph->xvalues() != nullptr && | ||
| flatbuffer_graph->xnodes() != nullptr, | ||
| InvalidProgram, | ||
| "Failed to deserialize XNNPACK flatbuffer graph; null graph, xvalues, or xnodes."); |
Internal failures on: #18799 `num_externs <= num_values` is not the right check. We should scan xvalues to find `num_externs` and use that, provided they are valid. Will put up separate PR for the change. Co-authored-by: Github Executorch <github_executorch@arm.com>
Add null checks to the flatbuffer graph on: - flatbuffer graph itself - xnodes - xvalues Check that num_externs is <= num_values Authored-with: Claude Co-authored-by: Github Executorch <github_executorch@arm.com>
Internal failures on: pytorch#18799 `num_externs <= num_values` is not the right check. We should scan xvalues to find `num_externs` and use that, provided they are valid. Will put up separate PR for the change. Co-authored-by: Github Executorch <github_executorch@arm.com>
Add null checks to the flatbuffer graph on:
Check that num_externs is <= num_values
Authored-with: Claude