CVE-2021-37640

Source
https://cve.org/CVERecord?id=CVE-2021-37640
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-37640.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-37640
Aliases
Downstream
Related
Published
2021-08-12T18:15:10.490Z
Modified
2026-04-11T16:26:09.538276Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
[none]
Details

TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of tf.raw_ops.SparseReshape can be made to trigger an integral division by 0 exception. The implementation calls the reshaping functor whenever there is at least an index in the input but does not check that shape of the input or the target shape have both a non-zero number of elements. The reshape functor blindly divides by the dimensions of the target shape. Hence, if this is not checked, code will result in a division by 0. We have patched the issue in GitHub commit 4923de56ec94fff7770df259ab7f2288a74feb41. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1 as this is the other affected version.

References

Affected packages

Git / github.com/tensorflow/tensorflow

Affected ranges

Type
GIT
Repo
https://github.com/tensorflow/tensorflow
Events
Introduced
Fixed
Introduced
Fixed
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
Fixed
Database specific
{
    "versions": [
        {
            "introduced": "2.3.0"
        },
        {
            "fixed": "2.3.4"
        },
        {
            "introduced": "2.4.0"
        },
        {
            "fixed": "2.4.3"
        },
        {
            "introduced": "0"
        },
        {
            "last_affected": "2.5.0"
        },
        {
            "introduced": "0"
        },
        {
            "last_affected": "2.6.0-rc0"
        },
        {
            "introduced": "0"
        },
        {
            "last_affected": "2.6.0-rc1"
        },
        {
            "introduced": "0"
        },
        {
            "last_affected": "2.6.0-rc2"
        }
    ]
}

Affected versions

0.*
0.5.0
0.6.0
v1.*
v1.1.0-rc1
v1.1.0-rc2
v1.12.1
v1.6.0-rc1
v1.9.0-rc2
v2.*
v2.3.0
v2.3.1
v2.3.2
v2.3.3
v2.4.0
v2.4.1
v2.4.2
v2.5.0
v2.5.0-rc0
v2.5.0-rc1
v2.5.0-rc2
v2.5.0-rc3
v2.6.0-rc0
v2.6.0-rc1
v2.6.0-rc2

Database specific

vanir_signatures
[
    {
        "digest": {
            "threshold": 0.9,
            "line_hashes": [
                "13715169316298277565868878877422379064",
                "87028526474003690116286118650178862417",
                "266780567341271000471695769975532248448",
                "291284188149720031622689698699532720678"
            ]
        },
        "id": "CVE-2021-37640-463105c2",
        "signature_type": "Line",
        "source": "https://github.com/tensorflow/tensorflow/commit/4923de56ec94fff7770df259ab7f2288a74feb41",
        "deprecated": false,
        "target": {
            "file": "tensorflow/core/kernels/reshape_util.cc"
        },
        "signature_version": "v1"
    },
    {
        "digest": {
            "function_hash": "216366359538036374288895408551788198173",
            "length": 3127.0
        },
        "id": "CVE-2021-37640-5e95d58c",
        "signature_type": "Function",
        "source": "https://github.com/tensorflow/tensorflow/commit/4923de56ec94fff7770df259ab7f2288a74feb41",
        "deprecated": false,
        "target": {
            "function": "ReshapeSparseTensor",
            "file": "tensorflow/core/kernels/reshape_util.cc"
        },
        "signature_version": "v1"
    }
]
source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-37640.json"
vanir_signatures_modified
"2026-04-11T16:26:09Z"