r2.11 cherry-pick: 08b8e18643d "Fix security vulnerability in EditDistance op shape function."
Refer to the original commit: https://github.com/tensorflow/tensorflow/commit/08b8e18643d6dcde00890733b270ff8d9960c56c