From 886ff67c1d61f5752f6055c0a3af25e3de9947c5 Mon Sep 17 00:00:00 2001 From: Songhao Jia Date: Tue, 28 Oct 2025 12:34:34 -0700 Subject: [PATCH] rasie error when trying to write a tensor without legal memory space Summary: as title Differential Revision: D85693113 --- devtools/etdump/etdump_flatcc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devtools/etdump/etdump_flatcc.cpp b/devtools/etdump/etdump_flatcc.cpp index a6e0a105069..ba7af1b8c2f 100644 --- a/devtools/etdump/etdump_flatcc.cpp +++ b/devtools/etdump/etdump_flatcc.cpp @@ -714,6 +714,10 @@ Result ETDumpGen::write_tensor_or_return_error(Tensor tensor) { return static_cast(-1); } + if (tensor.const_data_ptr() == nullptr) { + return Error::InvalidArgument; + } + if (!data_sink_) { return Error::InvalidArgument; }