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

Null-dereference in `mlir::tfg::TFOp::nameAttr` in TensorFlow

CVE-2022-36014

Description

TensorFlow is an open source platform for machine learning. When mlir::tfg::TFOp::nameAttr receives null type list attributes, it crashes. We have patched the issue in GitHub commits 3a754740d5414e362512ee981eefba41561a63a6 and a0f0b9a21c9270930457095092f558fbad4c03e5. 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
tensorflow-cpuPyPI
< 2.7.22.7.2
tensorflow-cpuPyPI
>= 2.8.0, < 2.8.12.8.1
tensorflow-cpuPyPI
>= 2.9.0, < 2.9.12.9.1
tensorflow-gpuPyPI
< 2.7.22.7.2
tensorflow-gpuPyPI
>= 2.8.0, < 2.8.12.8.1
tensorflow-gpuPyPI
>= 2.9.0, < 2.9.12.9.1

Affected products

1

Patches

2
a0f0b9a21c92

[TF] NodeDefs without an op name are invalid, return error on import

https://github.com/tensorflow/tensorflowA. Unique TensorFlowerJun 8, 2022via ghsa
2 files changed · +23 0
  • tensorflow/core/ir/importexport/graphdef_import.cc+3 0 modified
    @@ -746,6 +746,9 @@ StatusOr<unsigned> GraphDefImporter::ArgNumType(const NamedAttrList &attrs,
     Status GraphDefImporter::ConvertNodeDef(OpBuilder &builder, ConversionState &s,
                                             const NodeDef &node) {
       VLOG(4) << "Importing: " << node.name();
    +  if (node.op().empty())
    +    return InvalidArgument("Node ", node.name(), " has an empty op name");
    +
       OperationState state(ConvertLocation(node), absl::StrCat("tfg.", node.op()));
     
       // The GraphImporter does light shape inference, but here we will defer all of
    
  • tensorflow/core/ir/importexport/tests/graphdef_to_mlir/invalid_op_name.pbtxt+20 0 added
    @@ -0,0 +1,20 @@
    +# RUN: not tfg-translate -graphdef-to-mlir %s 2>&1 | FileCheck %s
    +
    +# CHECK: Node  has an empty op name
    +
    +library {
    +  function {
    +    signature {
    +      name: "\\344\\264\\264"
    +      description: "value"
    +      is_distributed_communication: true
    +    }
    +    node_def {
    +      input: "|"
    +    }
    +    control_ret {
    +      key: ""
    +      value: ""
    +    }
    +  }
    +}
    \ No newline at end of file
    
3a754740d541

[tfg] Fix null type attribute

https://github.com/tensorflow/tensorflowA. Unique TensorFlowerMay 20, 2022via ghsa
2 files changed · +26 3
  • tensorflow/core/ir/importexport/graphdef_import.cc+5 3 modified
    @@ -699,7 +699,8 @@ StatusOr<unsigned> GraphDefImporter::ArgNumType(const NamedAttrList &attrs,
                                                     SmallVectorImpl<Type> &types) {
       // Check whether a type list attribute is specified.
       if (!arg_def.type_list_attr().empty()) {
    -    if (auto v = attrs.get(arg_def.type_list_attr()).dyn_cast<ArrayAttr>()) {
    +    if (auto v =
    +            attrs.get(arg_def.type_list_attr()).dyn_cast_or_null<ArrayAttr>()) {
           for (Attribute attr : v) {
             if (auto dtype = attr.dyn_cast<TypeAttr>()) {
               types.push_back(UnrankedTensorType::get(dtype.getValue()));
    @@ -716,7 +717,8 @@ StatusOr<unsigned> GraphDefImporter::ArgNumType(const NamedAttrList &attrs,
       unsigned num = 1;
       // Check whether a number attribute is specified.
       if (!arg_def.number_attr().empty()) {
    -    if (auto v = attrs.get(arg_def.number_attr()).dyn_cast<IntegerAttr>()) {
    +    if (auto v =
    +            attrs.get(arg_def.number_attr()).dyn_cast_or_null<IntegerAttr>()) {
           num = v.getValue().getZExtValue();
         } else {
           return NotFound("Type attr not found: ", arg_def.number_attr());
    @@ -731,7 +733,7 @@ StatusOr<unsigned> GraphDefImporter::ArgNumType(const NamedAttrList &attrs,
         return InvalidArgument("Arg '", arg_def.name(),
                                "' has invalid type and no type attribute");
       } else {
    -    if (auto v = attrs.get(arg_def.type_attr()).dyn_cast<TypeAttr>()) {
    +    if (auto v = attrs.get(arg_def.type_attr()).dyn_cast_or_null<TypeAttr>()) {
           dtype = v.getValue();
         } else {
           return NotFound("Type attr not found: ", arg_def.type_attr());
    
  • tensorflow/core/ir/importexport/tests/graphdef_to_mlir/invalid_backedge_input_size.pbtxt+21 0 added
    @@ -0,0 +1,21 @@
    +# RUN: not tfg-translate -graphdef-to-mlir %s 2>&1 | FileCheck %s
    +
    +# CHECK: Type attr not found
    +
    +library {
    +  function {
    +    signature {
    +      name: "\344\264\264"
    +      description: "value"
    +      is_distributed_communication: true
    +    }
    +    node_def {
    +      op: "Const"
    +      input: "|"
    +    }
    +    control_ret {
    +      key: ""
    +      value: ""
    +    }
    +  }
    +}
    \ No newline at end of file
    

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.