VYPR
High severityNVD Advisory· Published Aug 12, 2021· Updated Aug 4, 2024

Null pointer dereference in TensorFlow Lite MLIR optimizations

CVE-2021-37689

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can craft a TFLite model that would trigger a null pointer dereference, which would result in a crash and denial of service. This is caused by the MLIR optimization of L2NormalizeReduceAxis operator. The implementation unconditionally dereferences a pointer to an iterator to a vector without checking that the vector has elements. We have patched the issue in GitHub commit d6b57f461b39fd1aa8c1b870f1b974aac3554955. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.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.3.42.3.4
tensorflowPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflowPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-cpuPyPI
< 2.3.42.3.4
tensorflow-cpuPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflow-cpuPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-gpuPyPI
< 2.3.42.3.4
tensorflow-gpuPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflow-gpuPyPI
>= 2.5.0, < 2.5.12.5.1

Affected products

1

Patches

1
d6b57f461b39

Prevent nullptr dereference in MLIR TFLite dialect/optimizer.

https://github.com/tensorflow/tensorflowMihai MaruseacJul 27, 2021via ghsa
1 file changed · +3 0
  • tensorflow/compiler/mlir/lite/transforms/optimize.cc+3 0 modified
    @@ -68,6 +68,9 @@ constexpr char kRelu6[] = "RELU6";
     constexpr char kRelu1[] = "RELU_N1_TO_1";
     
     bool L2NormalizeReduceAxis(Value sq_op, DenseElementsAttr axis) {
    +  if (axis.getNumElements() == 0) {
    +    return false;
    +  }
       if (sq_op.getType().cast<ShapedType>().getRank() - 1 ==
               *axis.getValues<int>().begin() ||
           *axis.getValues<int>().begin() == -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

8

News mentions

0

No linked articles in our index yet.