Skip to content
Permalink
Browse files Browse the repository at this point in the history
Prevent a crash due to heap OOB write in grappler.
PiperOrigin-RevId: 408318417
Change-Id: If095feb8c001e3a8ac4a85b7387b81e8309df47d
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Nov 8, 2021
1 parent 557a094 commit 97282c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tensorflow/core/grappler/costs/graph_properties.cc
Expand Up @@ -1134,7 +1134,12 @@ class SymbolicShapeRefiner {
GetUnknownOutputShape(node, output_port);
InferenceContext* ctx = GetContext(node);
if (ctx == nullptr) {
return errors::InvalidArgument("Missing context");
return errors::InvalidArgument("SetUnknownShape: Missing context");
}
if (output_port < 0 || output_port >= ctx->num_outputs()) {
return errors::InvalidArgument(
"SetUnknownShape: output_port must be in [0, ", ctx->num_outputs(),
") but was ", output_port);
}
ctx->set_output(output_port, shape);
return Status::OK();
Expand Down

0 comments on commit 97282c6

Please sign in to comment.