`CHECK` fail in `MaxPool` in TensorFlow
Description
TensorFlow is an open source platform for machine learning. When MaxPool receives a window size input array ksize with dimensions greater than its input tensor input, the GPU kernel gives a CHECK fail that can be used to trigger a denial of service attack. We have patched the issue in GitHub commit 32d7bd3defd134f21a4e344c8dfd40099aaf6b18. 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.
| Package | Affected versions | Patched versions |
|---|---|---|
tensorflowPyPI | < 2.7.2 | 2.7.2 |
tensorflowPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflowPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
tensorflow-cpuPyPI | < 2.7.2 | 2.7.2 |
tensorflow-cpuPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflow-cpuPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
tensorflow-gpuPyPI | < 2.7.2 | 2.7.2 |
tensorflow-gpuPyPI | >= 2.8.0, < 2.8.1 | 2.8.1 |
tensorflow-gpuPyPI | >= 2.9.0, < 2.9.1 | 2.9.1 |
Affected products
1- Range: < 2.7.2
Patches
132d7bd3defd1Fix MaxPool crash on GPU for invalid filter size.
2 files changed · +19 −0
tensorflow/core/kernels/maxpooling_op.cc+7 −0 modified@@ -1268,6 +1268,13 @@ class MaxPoolingNoMaskOp<GPUDevice, T> : public OpKernel { ShapeFromFormat(data_format_, params.tensor_in_batch, params.out_height, params.out_width, params.depth); + // Degenerate pooling output should return an empty tensor. + if (out_shape.num_elements() == 0) { + Tensor* output = nullptr; + OP_REQUIRES_OK(context, context->allocate_output(0, out_shape, &output)); + return; + } + // Assuming qint8 <--> NCHW_VECT_C (int8x4) here. constexpr bool is_int8x4 = std::is_same<T, qint8>::value; OP_REQUIRES(context, (is_int8x4 == (data_format_ == FORMAT_NCHW_VECT_C)),
tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py+12 −0 modified@@ -772,6 +772,18 @@ def testMaxPoolEmptyInput(self, **kwargs): expected=[], **kwargs) + @parameterized.parameters( + GetTestConfigsDicts(nn_ops.max_pool, gen_nn_ops.max_pool_v2)) + @test_util.run_deprecated_v1 + def testMaxPoolInvalidFilterSize(self, **kwargs): + with self.cached_session(use_gpu=test.is_gpu_available()): + t = constant_op.constant(1.0, shape=[1, 1, 1, 1]) + with self.assertRaisesRegex( + (errors_impl.InvalidArgumentError, ValueError), + "Negative dimension size"): + t = self.evaluate( + nn_ops.max_pool(t, ksize=[1, 1, 2, 1], strides=1, padding="VALID")) + # Tests for DepthwiseMaxPooling on CPU only. @parameterized.parameters( GetTestConfigsDicts(
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- github.com/advisories/GHSA-j43h-pgmg-5hjqghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-35989ghsaADVISORY
- github.com/tensorflow/tensorflow/commit/32d7bd3defd134f21a4e344c8dfd40099aaf6b18ghsax_refsource_MISCWEB
- github.com/tensorflow/tensorflow/releases/tag/v2.10.0ghsaWEB
- github.com/tensorflow/tensorflow/security/advisories/GHSA-j43h-pgmg-5hjqghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.