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

Null pointer exception in TensorFlow Lite

CVE-2021-37681

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of SVDF in TFLite is vulnerable to a null pointer error. The `GetVariableInput` function can return a null pointer but GetTensorData assumes that the argument is always a valid tensor. Furthermore, because GetVariableInput calls `GetMutableInput` which might return nullptr, the tensor->is_variable expression can also trigger a null pointer exception. We have patched the issue in GitHub commit 5b048e87e4e55990dae6b547add4dae59f4e1c76. 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
5b048e87e4e5

Fix a null pointer exception in SVDF

https://github.com/tensorflow/tensorflowMihai MaruseacJul 16, 2021via ghsa
2 files changed · +2 0
  • tensorflow/lite/kernels/kernel_util.cc+1 0 modified
    @@ -119,6 +119,7 @@ TfLiteStatus GetInputSafe(const TfLiteContext* context, const TfLiteNode* node,
     TfLiteTensor* GetVariableInput(TfLiteContext* context, const TfLiteNode* node,
                                    int index) {
       TfLiteTensor* tensor = GetMutableInput(context, node, index);
    +  if (tensor == nullptr) return nullptr;
       return tensor->is_variable ? tensor : nullptr;
     }
     
    
  • tensorflow/lite/kernels/svdf.cc+1 0 modified
    @@ -299,6 +299,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
                         GetTemporarySafe(context, node, /*index=*/0, &scratch));
     
       TfLiteTensor* state = GetVariableInput(context, node, kStateTensor);
    +  TF_LITE_ENSURE(context, state != nullptr);
       TfLiteTensor* output;
       TF_LITE_ENSURE_OK(context,
                         GetOutputSafe(context, node, kOutputTensor, &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

8

News mentions

0

No linked articles in our index yet.