From a895bdaf05f49117634c510ebfa20e47cbc9a679 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 11 Nov 2019 15:47:31 -0800 Subject: [PATCH] Return if an error status was set in LinearAlgebraOp::AnalyzeInput() or LinearAlgebraOp::PrepareOutputs(), instead of potentially crashing. PiperOrigin-RevId: 279834647 Change-Id: Iaef1b3598eaee212c75e397f4ffafce0ebfdf8b8 --- tensorflow/core/kernels/linalg_ops_common.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tensorflow/core/kernels/linalg_ops_common.cc b/tensorflow/core/kernels/linalg_ops_common.cc index 3836ff796eb..56a941fbd1f 100644 --- a/tensorflow/core/kernels/linalg_ops_common.cc +++ b/tensorflow/core/kernels/linalg_ops_common.cc @@ -92,11 +92,13 @@ void LinearAlgebraOp::Compute( TensorShapes input_matrix_shapes; TensorShape batch_shape; AnalyzeInputs(context, &inputs, &input_matrix_shapes, &batch_shape); + if (!context->status().ok()) return; TensorShapes output_matrix_shapes; TensorOutputs outputs; PrepareOutputs(context, input_matrix_shapes, batch_shape, &outputs, &output_matrix_shapes); + if (!context->status().ok()) return; // Process the individual matrix problems in parallel using a threadpool. auto shard = [this, &inputs, &input_matrix_shapes, &outputs,