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

Integer overflow due to conversion to unsigned in TensorFlow

CVE-2021-37645

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of tf.raw_ops.QuantizeAndDequantizeV4Grad is vulnerable to an integer overflow issue caused by converting a signed integer value to an unsigned one and then allocating memory based on this value. The implementation uses the axis value as the size argument to absl::InlinedVector constructor. But, the constructor uses an unsigned type for the argument, so the implicit conversion transforms the negative value to a large integer. We have patched the issue in GitHub commit 96f364a1ca3009f98980021c4b32be5fdcca33a1. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, and TensorFlow 2.4.3, as these are also affected and still in supported range.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
< 2.4.32.4.3
tensorflowPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-cpuPyPI
< 2.4.32.4.3
tensorflow-cpuPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-gpuPyPI
< 2.4.32.4.3
tensorflow-gpuPyPI
>= 2.5.0, < 2.5.12.5.1

Affected products

1

Patches

1
96f364a1ca30

Validate axis input in tf.raw_ops.QuantizeAndDequantizeV4Grad

https://github.com/tensorflow/tensorflowLaura PakAug 2, 2021via ghsa
1 file changed · +7 0
  • tensorflow/core/kernels/quantize_and_dequantize_op.cc+7 0 modified
    @@ -158,6 +158,13 @@ class QuantizeAndDequantizeV4GradientOp : public OpKernel {
         Tensor* input_backprop = nullptr;
         OP_REQUIRES_OK(ctx,
                        ctx->allocate_output(0, input.shape(), &input_backprop));
    +    OP_REQUIRES(
    +        ctx, axis_ >= -1,
    +        errors::InvalidArgument("Axis must be at least -1. Found ", axis_));
    +    OP_REQUIRES(ctx, (axis_ == -1 || axis_ < input.shape().dims()),
    +                errors::InvalidArgument(
    +                    "Axis should be -1 or 0 or a positive value less than ",
    +                    input.shape().dims(), "but given axis value was ", axis_));
     
         OP_REQUIRES(
             ctx, input.IsSameSize(gradient),
    

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.