Skip to content
Permalink
Browse files Browse the repository at this point in the history
Allowlist certain data types to avoid a seg fault.
PiperOrigin-RevId: 356326671
Change-Id: I23b65b52e93798cb5a6744632d31b0f88c6b6b31
  • Loading branch information
Amit Patankar authored and tensorflower-gardener committed Feb 8, 2021
1 parent f0e867d commit 4f663d4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tensorflow/core/kernels/immutable_constant_op.cc
Expand Up @@ -17,6 +17,8 @@ limitations under the License.

#include <unordered_set>

#include "tensorflow/core/framework/types.pb.h"

namespace tensorflow {

namespace {
Expand Down Expand Up @@ -86,6 +88,9 @@ ImmutableConstantOp::ImmutableConstantOp(OpKernelConstruction* context)
OP_REQUIRES_OK(context,
context->GetAttr(kMemoryRegionNameAttr, &region_name_));
OP_REQUIRES_OK(context, context->GetAttr(kDTypeAttr, &dtype_));
OP_REQUIRES(context, dtype_ != DT_RESOURCE && dtype_ != DT_VARIANT,
errors::InvalidArgument(
"Resource and variant dtypes are invalid for this op."));
OP_REQUIRES_OK(context, context->GetAttr(kShapeAttr, &shape_));
}

Expand Down

0 comments on commit 4f663d4

Please sign in to comment.