From 5b9d993a2e76576a101755b12d9965b45f28f352 Mon Sep 17 00:00:00 2001 From: Pranav Sharma Date: Thu, 14 Jan 2021 08:36:07 -0800 Subject: [PATCH] Fix DerefNullPtr issues raised by SDLNativeRules. (#6348) --- .../core/providers/cuda/cu_inc/binary_elementwise_impl.cuh | 4 ++-- onnxruntime/test/optimizer/cse_test.cc | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/providers/cuda/cu_inc/binary_elementwise_impl.cuh b/onnxruntime/core/providers/cuda/cu_inc/binary_elementwise_impl.cuh index 5824c516af..72f0d3652d 100644 --- a/onnxruntime/core/providers/cuda/cu_inc/binary_elementwise_impl.cuh +++ b/onnxruntime/core/providers/cuda/cu_inc/binary_elementwise_impl.cuh @@ -272,7 +272,7 @@ void BinaryElementWiseImpl( output_rank_or_simple_broadcast, *lhs_padded_strides, lhs_data, - *rhs_padded_strides, + TArray(), // rhs is not computed, so no need to deference rhs_padded_strides rhs_data, *fdm_output_strides, output_data, @@ -281,7 +281,7 @@ void BinaryElementWiseImpl( else _BinaryElementWise<<>>( output_rank_or_simple_broadcast, - *lhs_padded_strides, + TArray(), // lhs is not computed, so no need to deference lhs_padded_strides lhs_data, *rhs_padded_strides, rhs_data, diff --git a/onnxruntime/test/optimizer/cse_test.cc b/onnxruntime/test/optimizer/cse_test.cc index 8859959517..3ad91954cc 100644 --- a/onnxruntime/test/optimizer/cse_test.cc +++ b/onnxruntime/test/optimizer/cse_test.cc @@ -222,6 +222,9 @@ TEST(CseTests, Subgraph) { } } + ASSERT_NE(if_true_graph, nullptr); + ASSERT_NE(if_false_graph, nullptr); + output_names = GetSortedNames(if_true_graph->GetOutputs()); ASSERT_EQ(output_names, (std::vector{"Result1", "Result2", "Result3"}));