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

Division by zero in LSH in TensorFlow Lite

CVE-2021-37691

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 division by zero error in LSH implementation. We have patched the issue in GitHub commit 0575b640091680cfb70f4dd93e70658de43b94f9. The fix will be included in TensorFlow 2.6.0. We will also cherrypick thiscommit 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
0575b6400916

Prevent division by 0 in LSH projection.

https://github.com/tensorflow/tensorflowMihai MaruseacJul 27, 2021via ghsa
1 file changed · +2 1
  • tensorflow/lite/kernels/lsh_projection.cc+2 1 modified
    @@ -28,7 +28,7 @@ limitations under the License.
     //
     // Input:
     //   Tensor[0]: Hash functions. Dim.size == 2, DataType: Float.
    -//              Tensor[0].Dim[0]: Num of hash functions.
    +//              Tensor[0].Dim[0]: Num of hash functions. Must be at least 1.
     //              Tensor[0].Dim[1]: Num of projected output bits generated by
     //                                each hash function.
     //   In sparse case, Tensor[0].Dim[1] + ceil( log2(Tensor[0].Dim[0] )) <= 32.
    @@ -82,6 +82,7 @@ TfLiteStatus Resize(TfLiteContext* context, TfLiteNode* node) {
       const TfLiteTensor* input;
       TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 1, &input));
       TF_LITE_ENSURE(context, NumDimensions(input) >= 1);
    +  TF_LITE_ENSURE(context, SizeOfDimension(input, 0) >= 1);
     
       if (NumInputs(node) == 3) {
         const TfLiteTensor* weight;
    

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.