Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix null CHECK issue with tf.raw_ops.EncodePng.
PiperOrigin-RevId: 369717714
Change-Id: I24136cd99c20b8466671f4f93b670ef6f6dd1250
  • Loading branch information
Amit Patankar authored and tensorflower-gardener committed Apr 21, 2021
1 parent e312e07 commit 26eb323
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tensorflow/core/kernels/image/encode_png_op.cc
Expand Up @@ -54,6 +54,8 @@ class EncodePngOp : public OpKernel {
OP_REQUIRES(context, image.dims() == 3,
errors::InvalidArgument("image must be 3-dimensional",
image.shape().DebugString()));
OP_REQUIRES(context, image.NumElements() > 0,
errors::Internal("Invalid image provided."));
OP_REQUIRES(
context,
FastBoundsCheck(image.NumElements(), std::numeric_limits<int32>::max()),
Expand Down

0 comments on commit 26eb323

Please sign in to comment.