From 0c3af9326f23cb4a254c41a80679ab39f87e82d0 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 3 Dec 2019 13:03:44 -0800 Subject: [PATCH] Fix possible segfault with ShapeHandle. PiperOrigin-RevId: 283605264 Change-Id: I4531583f987439338f3207697f388fd1c74ccf23 --- tensorflow/core/framework/shape_inference.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/framework/shape_inference.h b/tensorflow/core/framework/shape_inference.h index aa0a6247312..b11df7e5d8a 100644 --- a/tensorflow/core/framework/shape_inference.h +++ b/tensorflow/core/framework/shape_inference.h @@ -306,7 +306,7 @@ class InferenceContext { // idx can be negative for an offset from end of dimensions. // idx must be in the range [-1 * s.rank, s.rank). DimensionHandle Dim(ShapeHandle s, int64 idx) { - if (s->rank_ == kUnknownRank) { + if (!s.Handle() || s->rank_ == kUnknownRank) { return UnknownDim(); } return DimKnownRank(s, idx);