VYPR
Low severityNVD Advisory· Published May 14, 2021· Updated Aug 3, 2024

Crash in `tf.strings.substr` due to `CHECK`-fail

CVE-2021-29617

Description

TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a denial of service via CHECK-fail in tf.strings.substr with invalid arguments. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
< 2.1.42.1.4
tensorflowPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflowPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflowPyPI
>= 2.4.0, < 2.4.22.4.2
tensorflow-cpuPyPI
< 2.1.42.1.4
tensorflow-cpuPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflow-cpuPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflow-cpuPyPI
>= 2.4.0, < 2.4.22.4.2
tensorflow-gpuPyPI
< 2.1.42.1.4
tensorflow-gpuPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflow-gpuPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflow-gpuPyPI
>= 2.4.0, < 2.4.22.4.2

Affected products

1

Patches

1
890f7164b703

Merge pull request #46974 from yongtang:46900-tf.strings.substr

https://github.com/tensorflow/tensorflowTensorFlower GardenerFeb 9, 2021via ghsa
2 files changed · +15 0
  • tensorflow/core/kernels/substr_op.cc+5 0 modified
    @@ -51,6 +51,11 @@ class SubstrOp : public OpKernel {
         const Tensor& len_tensor = context->input(2);
         const TensorShape& input_shape = input_tensor.shape();
         const TensorShape& pos_shape = pos_tensor.shape();
    +    const TensorShape& len_shape = len_tensor.shape();
    +    OP_REQUIRES(context, (pos_shape == len_shape),
    +                errors::InvalidArgument(
    +                    "pos and len should have the same shape, got: ",
    +                    pos_shape.DebugString(), " vs. ", len_shape.DebugString()));
     
         bool is_scalar = TensorShapeUtils::IsScalar(pos_shape);
     
    
  • tensorflow/python/kernel_tests/substr_op_test.py+10 0 modified
    @@ -492,6 +492,16 @@ def testInvalidUnit(self):
           with self.assertRaises(ValueError):
             string_ops.substr(b"test", 3, 1, unit="UTF8")
     
    +  def testInvalidPos(self):
    +    # Test case for GitHub issue 46900.
    +    with self.assertRaises((ValueError, errors_impl.InvalidArgumentError)):
    +      x = string_ops.substr(b"abc", len=1, pos=[1, -1])
    +      self.evaluate(x)
    +
    +    with self.assertRaises((ValueError, errors_impl.InvalidArgumentError)):
    +      x = string_ops.substr(b"abc", len=1, pos=[1, 2])
    +      self.evaluate(x)
    +
     
     if __name__ == "__main__":
       test.main()
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

9

News mentions

0

No linked articles in our index yet.