mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-01 23:30:35 +00:00
Fix segmentation fault caused by invalid tensor type (#4467)
* Fix segmentation fault caused by invalid tensor type * Addressed review comment
This commit is contained in:
parent
ccbf49e59f
commit
04586fc09d
1 changed files with 4 additions and 0 deletions
|
|
@ -842,6 +842,10 @@ Graph::Graph(const Model& owning_model,
|
|||
NodeArg* matching_graph_input = GetNodeArg(tensor.name());
|
||||
TypeProto t{TypeProtoFromTensorProto(tensor)};
|
||||
|
||||
if (!utils::HasElemType(t.tensor_type())) {
|
||||
ORT_THROW("This is an invalid model. Tensor does not have type information.");
|
||||
}
|
||||
|
||||
if (ir_version_ < 4) {
|
||||
// initializers can have matching graph inputs but are treated as constant,
|
||||
// so we prefer the shape from the initializer
|
||||
|
|
|
|||
Loading…
Reference in a new issue