runtime: null-check sizes and dim_order in validateTensorLayout#19878
runtime: null-check sizes and dim_order in validateTensorLayout#19878vacu9708 wants to merge 1 commit into
Conversation
`validateTensorLayout` is called from `Method::parse_external_constants` before `parseTensor` runs its own null checks. Under the default `Verification::Minimal`, a null `sizes` or `dim_order` field in a corrupted PTE causes a SIGSEGV instead of a clean error return. Fixes the gap and adds two regression tests. Signed-off-by: Youngsik Yang <vacu9708@gmail.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19878
Note: Links to docs will display an error until the docs builds have been completed. ❌ You can merge normally! (2 Unrelated Failures), 1 Unclassified FailureAs of commit fa988fd with merge base acce7cd ( UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
BROKEN TRUNK - The following jobs 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
|
Summary
validateTensorLayoutdereferencess_tensor->sizes()ands_tensor->dim_order()without null-checking them first. Both fields are nullable in the schema, and the function is called fromMethod::parse_external_constantsbeforeparseTensor(which does null-check both) runs. Under the defaultVerification::Minimal, a corrupted.pte/.ptdwith either field null causes a SIGSEGV instead of a clean error return.This PR adds the two missing null guards. Same pattern as #19267 and #17131, which hardened the same function.
Error code: used
InvalidExternalDatato match the other checks insidevalidateTensorLayout.Test result
./test/run_oss_cpp_tests.sh lintrunner runtime/executor/tensor_parser_exec_aten.cpp \ runtime/executor/test/tensor_parser_test.cppResult:
0 tests failed out of 82. Lint clean.