Skip to content

Commit 78ee5df

Browse files
Gasoonjiafacebook-github-bot
authored andcommitted
rasie error when trying to write a tensor without legal memory space
Summary: as title Differential Revision: D85693113
1 parent 94def70 commit 78ee5df

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

devtools/etdump/etdump_flatcc.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,10 @@ Result<long> ETDumpGen::write_tensor_or_return_error(Tensor tensor) {
714714
return static_cast<size_t>(-1);
715715
}
716716

717+
if (tensor.const_data_ptr() == nullptr) {
718+
return Error::InvalidArgument;
719+
}
720+
717721
if (!data_sink_) {
718722
return Error::InvalidArgument;
719723
}

0 commit comments

Comments
 (0)