VYPR
Low severityNVD Advisory· Published May 14, 2021· Updated Aug 3, 2024

Division by 0 in `QuantizedBiasAdd`

CVE-2021-29546

Description

TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger an integer division by zero undefined behavior in tf.raw_ops.QuantizedBiasAdd. This is because the implementation of the Eigen kernel(https://github.com/tensorflow/tensorflow/blob/61bca8bd5ba8a68b2d97435ddfafcdf2b85672cd/tensorflow/core/kernels/quantization_utils.h#L812-L849) does a division by the number of elements of the smaller input (based on shape) without checking that this is not zero. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.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.1.42.1.4
tensorflowPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflowPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflowPyPI
>= 2.4.0, < 2.4.22.4.2
tensorflow-cpuPyPI
< 2.1.42.1.4
tensorflow-cpuPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflow-cpuPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflow-cpuPyPI
>= 2.4.0, < 2.4.22.4.2
tensorflow-gpuPyPI
< 2.1.42.1.4
tensorflow-gpuPyPI
>= 2.2.0, < 2.2.32.2.3
tensorflow-gpuPyPI
>= 2.3.0, < 2.3.32.3.3
tensorflow-gpuPyPI
>= 2.4.0, < 2.4.22.4.2

Affected products

1

Patches

1
677847008694

Prevent division by 0 in `QuantizedBiasAdd`.

https://github.com/tensorflow/tensorflowMihai MaruseacApr 23, 2021via ghsa
1 file changed · +2 0
  • tensorflow/core/kernels/quantized_bias_add_op.cc+2 0 modified
    @@ -56,6 +56,8 @@ class QuantizedBiasAddOp : public OpKernel {
                 "Must provide as many biases as the last dimension "
                 "of the input tensor: ",
                 bias.shape().DebugString(), " vs. ", input.shape().DebugString()));
    +    OP_REQUIRES(context, bias.NumElements() > 0,
    +                errors::InvalidArgument("Must provide at least 1 bias"));
     
         Tensor* output = nullptr;
         OP_REQUIRES_OK(context,
    

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.