Null dereference on MLIR on empty function attributes in TensorFlow
Description
TensorFlow is an open source platform for machine learning. When mlir::tfg::ConvertGenericFunctionToFunctionDef is given empty function attributes, it gives a null dereference. We have patched the issue in GitHub commit aed36912609fc07229b4d0a7b44f3f48efc00fd0. 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
1aed36912609fCheck correct input/output scalar types for LinearAlgebraOp.
2 files changed · +24 −0
tensorflow/core/kernels/linalg/linalg_ops_common.cc+12 −0 modified@@ -15,14 +15,17 @@ limitations under the License. #include "tensorflow/core/kernels/linalg/linalg_ops_common.h" +#include <initializer_list> #include <utility> #include "third_party/eigen3/Eigen/Core" #include "tensorflow/core/framework/device_base.h" #include "tensorflow/core/framework/kernel_def_builder.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" #include "tensorflow/core/lib/core/errors.h" +#include "tensorflow/core/platform/errors.h" #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/types.h" @@ -152,6 +155,10 @@ void LinearAlgebraOp<InputScalar, OutputScalar>::AnalyzeInputs( input_matrix_shapes->emplace_back( std::initializer_list<int64_t>({num_rows, num_cols})); inputs->emplace_back(&in); + OP_REQUIRES( + context, in.dtype() == DataTypeToEnum<InputScalar>::v(), + errors::InvalidArgument("Invalid input dtype ", in.dtype(), " vs ", + DataTypeToEnum<InputScalar>::v())); } // Have the derived class validate that the inputs are as expected. ValidateInputMatrixShapes(context, *input_matrix_shapes); @@ -212,6 +219,11 @@ void LinearAlgebraOp<InputScalar, OutputScalar>::PrepareOutputs( OP_REQUIRES_OK(context, context->allocate_output( output_idx, output_tensor_shape, &out)); } + OP_REQUIRES( + context, out->dtype() == DataTypeToEnum<OutputScalar>::v(), + errors::InvalidArgument("Invalid output dtype ", out->dtype(), " vs ", + DataTypeToEnum<OutputScalar>::v())); + outputs->emplace_back(out); } }
tensorflow/python/kernel_tests/linalg/eig_op_test.py+12 −0 modified@@ -18,8 +18,10 @@ from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes as dtypes_lib +from tensorflow.python.framework import errors from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops +from tensorflow.python.ops import gen_linalg_ops from tensorflow.python.ops import gradient_checker_v2 from tensorflow.python.ops import linalg_ops from tensorflow.python.ops import math_ops @@ -88,6 +90,16 @@ def testMatrixThatFailsWhenFlushingDenormsToZero(self): self.assertAllClose(matrix, np.matmul(np.matmul(v, np.diag(e)), v.transpose())) + def testMismatchedDtypes(self): + tensor = constant_op.constant([[0, 1], [2, 3]], dtype=dtypes_lib.float32) + with self.assertRaisesRegex((ValueError, errors.InvalidArgumentError), + "Invalid output dtype"): + self.evaluate( + gen_linalg_ops.eig( + input=tensor, + Tout=dtypes_lib.complex128, # Expected dtype: complex64. + compute_v=True)) + def SortEigenValues(e): perm = np.argsort(e.real + e.imag, -1)
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-fqxc-pvf8-2w9vghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-36000ghsaADVISORY
- github.com/tensorflow/tensorflow/commit/aed36912609fc07229b4d0a7b44f3f48efc00fd0ghsax_refsource_MISCWEB
- github.com/tensorflow/tensorflow/releases/tag/v2.10.0ghsaWEB
- github.com/tensorflow/tensorflow/security/advisories/GHSA-fqxc-pvf8-2w9vghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.