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

Segfault in `tf.raw_ops.SparseCountSparseOutput`

CVE-2021-29619

Description

TensorFlow is an end-to-end open source platform for machine learning. Passing invalid arguments (e.g., discovered via fuzzing) to tf.raw_ops.SparseCountSparseOutput results in segfault. 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
82e620322186

Fix segfaults in `tf.raw_ops.SparseCountSparseOutput`.

https://github.com/tensorflow/tensorflowAmit PatankarMar 3, 2021via ghsa
1 file changed · +12 0
  • tensorflow/core/kernels/count_ops.cc+12 0 modified
    @@ -192,6 +192,10 @@ class SparseCount : public OpKernel {
                   "; values shape: ", values.shape().DebugString()));
         }
     
    +    OP_REQUIRES(context, shape.NumElements() != 0,
    +                errors::InvalidArgument(
    +                    "The shape argument requires at least one element."));
    +
         bool is_1d = shape.NumElements() == 1;
         int num_batches = is_1d ? 1 : shape.flat<int64>()(0);
         int num_values = values.NumElements();
    @@ -212,6 +216,14 @@ class SparseCount : public OpKernel {
     
         for (int idx = 0; idx < num_values; ++idx) {
           int batch = is_1d ? 0 : indices_values(idx, 0);
    +      if (batch >= num_batches) {
    +        OP_REQUIRES(context, batch < num_batches,
    +                    errors::InvalidArgument(
    +                        "Indices value along the first dimension must be ",
    +                        "lower than the first index of the shape.", "Got ",
    +                        batch, " as batch and ", num_batches,
    +                        " as the first dimension of the shape."));
    +      }
           const auto& value = values_values(idx);
           if (value >= 0 && (maxlength_ <= 0 || value < maxlength_)) {
             if (binary_output_) {
    

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

7

News mentions

0

No linked articles in our index yet.