CVE-2021-41219

Undefined behavior via `nullptr` reference binding in sparse matrix multiplication

HIGH
7.8
CVSS Score
Published: November 5, 2021 at 08:50 PM UTC
Updated: June 17, 2026 at 04:08 AM UTC
2 products affected across 2 vendorsTensorflowTensorFlow

Using tensorflow by tensorflow?

Get instant alerts when new vulnerabilities affect tensorflow - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.8
Exploit prediction
EPSS 0.2%

Description

TensorFlow is an open source platform for machine learning. In affected versions the code for sparse matrix multiplication is vulnerable to undefined behavior via binding a reference to `nullptr`. This occurs whenever the dimensions of `a` or `b` are 0 or less. In the case on one of these is 0, an empty output tensor should be allocated (to conserve the invariant that output tensors are always allocated when the operation is successful) but nothing should be written to it (that is, we should return early from the kernel implementation). Otherwise, attempts to write to this empty tensor would result in heap OOB access. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

v < 2.4.42.5.0 ≤ v < 2.5.22.6.0
Affected range stops below 2.4.4, so it looks safe — our inference, not a vendor statement
Affected range stops below 2.5.2, so it looks safe — our inference, not a vendor statement
v < 2.4.4v < 2.5.2v < 2.6.1
Affected range stops below 2.4.4, so it looks safe — our inference, not a vendor statement
Affected range stops below 2.5.2, so it looks safe — our inference, not a vendor statement
Affected range stops below 2.6.1, so it looks safe — our inference, not a vendor statement

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

CVSS

7.8HIGHGitHub_M
Attack Vector
LOCAL
Complexity
LOW
Privileges
LOW
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
HIGH
Integrity
HIGH
Availability
HIGH
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-824CWE-125

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card