From 301ae88b331d37a2a16159b65b255f4f9eb39314 Mon Sep 17 00:00:00 2001 From: Laura Pak Date: Mon, 12 Jul 2021 09:59:54 -0700 Subject: [PATCH] Fix null ptr deref in tf.raw_ops.RaggedTensorToTensor PiperOrigin-RevId: 384257511 Change-Id: I0484ad285039d132d6c41b284a7fcdd2b774a38e --- tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc b/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc index b79a07e67ba91..1749a6e24784d 100644 --- a/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc +++ b/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc @@ -348,6 +348,9 @@ class RaggedTensorToTensorBaseOp : public OpKernel { Status GetFirstDimensionSize(OpKernelContext* context, INDEX_TYPE* result) { const Tensor first_partition_tensor = context->input(kFirstPartitionInputIndex); + if (row_partition_types_.empty()) { + return errors::InvalidArgument("No row_partition_types given."); + } const RowPartitionType first_partition_type = row_partition_types_[0]; switch (first_partition_type) { case RowPartitionType::FIRST_DIM_SIZE: