High severity8.1OSV Advisory· Published Jul 11, 2025· Updated Apr 15, 2026
CVE-2025-30402
CVE-2025-30402
Description
A heap-buffer-overflow vulnerability in the loading of ExecuTorch methods can cause the runtime to crash and potentially result in code execution or other undesirable effects. This issue affects ExecuTorch prior to commit 93b1a0c15f7eda49b2bc46b5b4c49557b4e9810f
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
executorchPyPI | < 0.7.0 | 0.7.0 |
org.pytorch:executorch-androidMaven | < 0.7.0-rc1 | 0.7.0-rc1 |
github.com/pytorch/executorchSwiftURL | < 0.7.0-rc1 | 0.7.0-rc1 |
Affected products
1- Range: ciflow/binaries/all/sdym, ciflow/binaries/sdym, stable-2023-08-01, …
Patches
193b1a0c15f7echeck for overflow in calculate_nbytes (#11217)
4 files changed · +73 −6
.github/workflows/pull.yml+2 −2 modified@@ -371,7 +371,7 @@ jobs: size=${arr[4]} # threshold=48120 on devserver with gcc11.4 # todo(lfq): update once binary size is below 50kb. - threshold="51408" + threshold="55504" if [[ "$size" -le "$threshold" ]]; then echo "Success $size <= $threshold" else @@ -406,7 +406,7 @@ jobs: output=$(ls -la cmake-out/test/size_test) arr=($output) size=${arr[4]} - threshold="47560" + threshold="51656" if [[ "$size" -le "$threshold" ]]; then echo "Success $size <= $threshold" else
runtime/executor/method_meta.cpp+15 −3 modified@@ -55,12 +55,24 @@ Result<Tag> get_tag( size_t calculate_nbytes( Span<const int32_t> sizes, executorch::aten::ScalarType scalar_type) { - ssize_t n = 1; + size_t n = 1; + size_t prev_n = 1; for (size_t i = 0; i < sizes.size(); i++) { + prev_n = n; n *= sizes[i]; + // Check for overflow + ET_CHECK(sizes[i] == 0 || n / sizes[i] == prev_n); } - // Use the full namespace to disambiguate from c10::elementSize. - return n * executorch::runtime::elementSize(scalar_type); + + size_t elem_size = executorch::runtime::elementSize(scalar_type); + + prev_n = n; + n = n * elem_size; + + // Check for overflow + ET_CHECK(elem_size == 0 || n / elem_size == prev_n); + + return n; } } // namespace
runtime/executor/method_meta.h+5 −0 modified@@ -21,6 +21,10 @@ struct ExecutionPlan; namespace executorch { namespace ET_RUNTIME_NAMESPACE { +namespace testing { +// Provides test access to private Program methods. +class TensorInfoTestFriend; +} // namespace testing /** * Metadata about a specific tensor of an ExecuTorch Program. @@ -71,6 +75,7 @@ class TensorInfo final { private: // Let MethodMeta create TensorInfo. friend class MethodMeta; + friend class testing::TensorInfoTestFriend; TensorInfo( Span<const int32_t> sizes,
runtime/executor/test/method_meta_test.cpp+51 −1 modified@@ -9,21 +9,48 @@ #include <executorch/runtime/executor/method_meta.h> #include <cstdlib> -#include <filesystem> +#include <limits> +#include <vector> #include <executorch/extension/data_loader/file_data_loader.h> #include <executorch/runtime/core/exec_aten/exec_aten.h> #include <executorch/runtime/executor/program.h> +#include <executorch/test/utils/DeathTest.h> #include <gtest/gtest.h> using namespace ::testing; using executorch::runtime::Error; using executorch::runtime::MethodMeta; using executorch::runtime::Program; using executorch::runtime::Result; +using executorch::runtime::Span; using executorch::runtime::TensorInfo; using torch::executor::util::FileDataLoader; +namespace executorch { +namespace runtime { +namespace testing { +// Provides access to private TensorInfo methods. +class TensorInfoTestFriend final { + public: + ET_NODISCARD static TensorInfo get( + Span<const int32_t> sizes, + Span<const uint8_t> dim_order, + executorch::aten::ScalarType scalar_type, + const bool is_memory_planned, + executorch::aten::string_view name) { + return TensorInfo( + Span<const int32_t>(sizes.data(), sizes.size()), + Span<const uint8_t>(dim_order.data(), dim_order.size()), + scalar_type, + is_memory_planned, + name); + } +}; +} // namespace testing +} // namespace runtime +} // namespace executorch + class MethodMetaTest : public ::testing::Test { protected: void load_program(const char* path, const char* module_name) { @@ -163,3 +190,26 @@ TEST_F(MethodMetaTest, MethodMetaAttribute) { auto bad_access = method_meta->attribute_tensor_meta(1); ASSERT_EQ(bad_access.error(), Error::InvalidArgument); } + +TEST_F(MethodMetaTest, TensorInfoSizeOverflow) { + // Create sizes that will cause overflow when multiplied + std::vector<int32_t> overflow_sizes = { + std::numeric_limits<int32_t>::max(), + std::numeric_limits<int32_t>::max(), + std::numeric_limits<int32_t>::max(), + std::numeric_limits<int32_t>::max(), + }; + + // Create a minimal dim_order + std::vector<uint8_t> dim_order = {0, 1, 2, 3}; + + // Create a TensorInfo with the overflow sizes and expect it to fail. + ET_EXPECT_DEATH( + executorch::runtime::testing::TensorInfoTestFriend::get( + Span<const int32_t>(overflow_sizes.data(), overflow_sizes.size()), + Span<const uint8_t>(dim_order.data(), dim_order.size()), + executorch::aten::ScalarType::Float, + false, // is_memory_planned + executorch::aten::string_view{nullptr, 0}), + ""); +}
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4News mentions
0No linked articles in our index yet.