Arm backend: Fix integer overflow in VGFBackend IO size computation#19256
Arm backend: Fix integer overflow in VGFBackend IO size computation#19256
Conversation
Replace std::accumulate with std::multiplies<>() with an explicit loop using c10::mul_overflows() to detect overflow before each multiplication. The previous code would silently wrap on overflow, producing an undersized memcpy size that could lead to out-of-bounds reads/writes when copying tensor data to/from Vulkan device memory. Also reject negative dimensions before casting to size_t. Addresses TOB-EXECUTORCH-27. This PR was authored with the assistance of Claude.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19256
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 3 Unrelated FailuresAs of commit aa1f963 with merge base 5e8a0df ( NEW FAILURE - The following job has failed:
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. |
|
@claude review |
This PR needs a
|
|
Claude finished @lucylq's task in 1m 6s —— View job Code Review: Fix integer overflow in VGFBackend IO size computation
Overall: This is a solid security fix. The approach of using Minor issues:
Looks good to merge. The only actionable item is the stale |
Replace std::accumulate with std::multiplies<>() with an explicit loop using c10::mul_overflows() to detect overflow before each multiplication. The previous code would silently wrap on overflow, producing an undersized memcpy size that could lead to out-of-bounds reads/writes when copying tensor data to/from Vulkan device memory.
Also reject negative dimensions before casting to size_t.
This PR was authored with the assistance of Claude.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell