VYPR
Moderate severityNVD Advisory· Published Sep 16, 2022· Updated Apr 23, 2025

`CHECK` fail in `EmptyTensorList` in TensorFlow

CVE-2022-35998

Description

TensorFlow is an open source platform for machine learning. If EmptyTensorList receives an input element_shape with more than one dimension, it gives a CHECK fail that can be used to trigger a denial of service attack. We have patched the issue in GitHub commit c8ba76d48567aed347508e0552a257641931024d. The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. There are no known workarounds for this issue.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
< 2.7.22.7.2
tensorflowPyPI
>= 2.8.0, < 2.8.12.8.1
tensorflowPyPI
>= 2.9.0, < 2.9.12.9.1

Affected products

1

Patches

1
c8ba76d48567

Fix tf.raw_ops.EmptyTensorList vulnerability with invalid `element_shape`.

https://github.com/tensorflow/tensorflowAlan LiuJul 19, 2022via ghsa
2 files changed · +16 4
  • tensorflow/core/kernels/list_kernels.cc+7 4 modified
    @@ -21,7 +21,11 @@ limitations under the License.
     
     #include "tensorflow/core/kernels/list_kernels.h"
     
    +#include <algorithm>
    +#include <iterator>
     #include <limits>
    +#include <memory>
    +#include <utility>
     
     #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
     #include "tensorflow/core/framework/allocator.h"
    @@ -30,10 +34,6 @@ limitations under the License.
     #include "tensorflow/core/framework/tensor_types.h"
     #include "tensorflow/core/framework/variant.h"
     #include "tensorflow/core/framework/variant_op_registry.h"
    -#include "tensorflow/core/kernels/concat_lib.h"
    -#include "tensorflow/core/lib/core/coding.h"
    -#include "tensorflow/core/lib/core/errors.h"
    -#include "tensorflow/core/util/util.h"
     
     namespace tensorflow {
     
    @@ -49,6 +49,9 @@ Status TensorShapeFromTensor(const Tensor& t, PartialTensorShape* out) {
         return errors::InvalidArgument(
             "The only valid scalar shape tensor is the fully unknown shape "
             "specified as -1.");
    +  } else if (t.shape().dims() != 1) {
    +    return errors::InvalidArgument("Shape must be at most rank 1 but is rank ",
    +                                   t.shape().dims());
       }
       if (t.dtype() == DT_INT32) {
         return PartialTensorShape::MakePartialShape(t.vec<int32>().data(),
    
  • tensorflow/python/kernel_tests/data_structures/list_ops_test.py+9 0 modified
    @@ -1458,6 +1458,15 @@ def testConcatWithUninitializedTensorsFailsIfNoInputLengths(self):
           t = list_ops.tensor_list_concat(l, element_dtype=dtypes.float32)
           self.evaluate(t)
     
    +  def testEmptyTensorListInvalidShape(self):
    +    with self.assertRaisesRegex((ValueError, errors.InvalidArgumentError),
    +                                r"Shape must be at most rank 1 but is rank 2"):
    +      t = gen_list_ops.EmptyTensorList(
    +          element_shape=array_ops.ones(dtype=dtypes.int32, shape=[1, 0]),
    +          max_num_elements=constant_op.constant(1),
    +          element_dtype=dtypes.int32)
    +      self.evaluate(t)
    +
       def testEvenSplit(self):
     
         def RunTest(input_tensor, lengths, expected_stacked_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

5

News mentions

0

No linked articles in our index yet.