Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. tensorflow-cpu
  4. ›
  5. CVE-2021-29585

CVE-2021-29585: Division by zero in padding computation in TFLite

May 21, 2021 (updated November 13, 2024)

The TFLite computation for size of output after padding, ComputeOutSize, does not check that the stride argument is not 0 before doing the division.

inline int ComputeOutSize(TfLitePadding padding, int image_size,
int filter_size, int stride, int dilation_rate = 1) {
int effective_filter_size = (filter_size - 1) * dilation_rate + 1;
switch (padding) {
case kTfLitePaddingSame:
return (image_size + stride - 1) / stride;
case kTfLitePaddingValid:
return (image_size + stride - effective_filter_size) / stride;
default:
return 0;
}
}

Users can craft special models such that ComputeOutSize is called with stride set to 0.

References

  • github.com/advisories/GHSA-mv78-g7wq-mhp4
  • github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-513.yaml
  • github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-711.yaml
  • github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-222.yaml
  • github.com/tensorflow/tensorflow
  • github.com/tensorflow/tensorflow/blob/0c9692ae7b1671c983569e5d3de5565843d500cf/tensorflow/lite/kernels/padding.h
  • github.com/tensorflow/tensorflow/commit/49847ae69a4e1a97ae7f2db5e217c77721e37948
  • github.com/tensorflow/tensorflow/security/advisories/GHSA-mv78-g7wq-mhp4
  • nvd.nist.gov/vuln/detail/CVE-2021-29585

Code Behaviors & Features

Detect and mitigate CVE-2021-29585 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.1.4, all versions starting from 2.2.0 before 2.2.3, all versions starting from 2.3.0 before 2.3.3, all versions starting from 2.4.0 before 2.4.2

Fixed versions

  • 2.1.4
  • 2.2.3
  • 2.3.3
  • 2.4.2

Solution

Upgrade to versions 2.1.4, 2.2.3, 2.3.3, 2.4.2 or above.

Impact 7.8 HIGH

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-369: Divide By Zero

Source file

pypi/tensorflow-cpu/CVE-2021-29585.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:15 +0000.