Fix possible null pointer dereference. (#10373)

NodeInfo::p_node was used directly but it can be null from here:
2afce4830c/onnxruntime/core/framework/session_state_utils.cc (L381-L382)

Add an additional check that it is not null before use.
This commit is contained in:
Edward Chen 2022-01-25 14:48:51 -08:00 committed by GitHub
parent e1012a8662
commit 5eafbb50f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ static common::Status SyncProviders(const SessionState::NameNodeInfoMapType& nod
std::set<std::string> providers;
for (auto& pair : node_info_map) {
for (auto& node_info : pair.second) {
if (node_info.p_node->GetExecutionProviderType() != onnxruntime::kCpuExecutionProvider) {
if (node_info.p_node && node_info.p_node->GetExecutionProviderType() != onnxruntime::kCpuExecutionProvider) {
providers.insert(node_info.p_node->GetExecutionProviderType());
}
}