Skip to content
Permalink
Browse files Browse the repository at this point in the history
Prevent denial of service in tf.ragged.constant
Fixes #55199

PiperOrigin-RevId: 442029525
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Apr 15, 2022
1 parent e74ef07 commit bd4d558
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tensorflow/python/ops/ragged/ragged_factory_ops.py
Expand Up @@ -188,6 +188,9 @@ def _constant_value(ragged_factory, inner_factory, pylist, dtype, ragged_rank,
if max_depth > scalar_depth:
raise ValueError("Invalid pylist=%r: empty list nesting is greater "
"than scalar value nesting" % pylist)
if ragged_rank is not None and max_depth < ragged_rank:
raise ValueError(f"Invalid pylist={pylist}, max depth smaller than "
f"ragged_rank={ragged_rank}")

# If both inner_shape and ragged_rank were specified, then check that
# they are compatible with pylist.
Expand Down

0 comments on commit bd4d558

Please sign in to comment.