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

Heap OOB read in `tf.raw_ops.Dequantize`

CVE-2021-29582

Description

TensorFlow is an end-to-end open source platform for machine learning. Due to lack of validation in tf.raw_ops.Dequantize, an attacker can trigger a read from outside of bounds of heap allocated data. The implementation(https://github.com/tensorflow/tensorflow/blob/26003593aa94b1742f34dc22ce88a1e17776a67d/tensorflow/core/kernels/dequantize_op.cc#L106-L131) accesses the min_range and max_range tensors in parallel but fails to check that they have the same shape. 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
5899741d0421

Fix heap OOB read in dequantize op.

https://github.com/tensorflow/tensorflowMihai MaruseacMay 6, 2021via ghsa
1 file changed · +12 0
  • tensorflow/core/kernels/dequantize_op.cc+12 0 modified
    @@ -98,6 +98,18 @@ class DequantizeOp : public OpKernel {
         if (axis_ > -1) {
           num_slices = input.dim_size(axis_);
         }
    +    OP_REQUIRES(ctx, input_min_tensor.NumElements() == num_slices,
    +                errors::InvalidArgument(
    +                    "input_min_tensor must have as many elements as input on "
    +                    "the dequantization axis (",
    +                    axis_, "), got ", input_min_tensor.NumElements(),
    +                    ", expected ", num_slices));
    +    OP_REQUIRES(ctx, input_max_tensor.NumElements() == num_slices,
    +                errors::InvalidArgument(
    +                    "input_max_tensor must have as many elements as input on "
    +                    "the dequantization axis (",
    +                    axis_, "), got ", input_max_tensor.NumElements(),
    +                    ", expected ", num_slices));
     
         Tensor* output = nullptr;
         OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output));
    

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.