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

Memory corruption in `DrawBoundingBoxesV2`

CVE-2021-29571

Description

TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. 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
79865b542f9f

Fix memory corruption issue with `tf.raw_ops.DrawBoundingBoxesV2`.

https://github.com/tensorflow/tensorflowAmit PatankarMay 5, 2021via ghsa
1 file changed · +6 0
  • tensorflow/core/kernels/image/draw_bounding_box_op.cc+6 0 modified
    @@ -73,6 +73,12 @@ class DrawBoundingBoxesOp : public OpKernel {
             errors::InvalidArgument("Channel depth should be either 1 (GRY), "
                                     "3 (RGB), or 4 (RGBA)"));
     
    +    OP_REQUIRES(
    +        context, boxes.dim_size(2) == 4,
    +        errors::InvalidArgument(
    +            "The size of the third dimension of the box must be 4. Received: ",
    +            boxes.dim_size(2)));
    +
         const int64 batch_size = images.dim_size(0);
         const int64 height = images.dim_size(1);
         const int64 width = images.dim_size(2);
    

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.