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

Heap buffer overflow in `FractionalAvgPoolGrad` in TensorFlow

CVE-2021-37651

Description

TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation for tf.raw_ops.FractionalAvgPoolGrad can be tricked into accessing data outside of bounds of heap allocated buffers. The implementation does not validate that the input tensor is non-empty. Thus, code constructs an empty EigenDoubleMatrixMap and then accesses this buffer with indices that are outside of the empty area. We have patched the issue in GitHub commit 0f931751fb20f565c4e94aa6df58d54a003cdb30. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.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.3.42.3.4
tensorflowPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflowPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-cpuPyPI
< 2.3.42.3.4
tensorflow-cpuPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflow-cpuPyPI
>= 2.5.0, < 2.5.12.5.1
tensorflow-gpuPyPI
< 2.3.42.3.4
tensorflow-gpuPyPI
>= 2.4.0, < 2.4.32.4.3
tensorflow-gpuPyPI
>= 2.5.0, < 2.5.12.5.1

Affected products

1

Patches

1
0f931751fb20

Validate dimensions of input tensor in `FractionalAvgPoolGrad`

https://github.com/tensorflow/tensorflowMihai MaruseacAug 2, 2021via ghsa
1 file changed · +12 0
  • tensorflow/core/kernels/fractional_avg_pool_op.cc+12 0 modified
    @@ -271,6 +271,18 @@ class FractionalAvgPoolGradOp : public OpKernel {
         const int64_t in_rows = orig_input_tensor_shape_flat(1);
         const int64_t in_cols = orig_input_tensor_shape_flat(2);
         const int64_t in_depth = orig_input_tensor_shape_flat(3);
    +    OP_REQUIRES(
    +        context, in_batch != 0,
    +        errors::InvalidArgument("Batch dimension of input must not be 0"));
    +    OP_REQUIRES(
    +        context, in_rows != 0,
    +        errors::InvalidArgument("Rows dimension of input must not be 0"));
    +    OP_REQUIRES(
    +        context, in_cols != 0,
    +        errors::InvalidArgument("Columns dimension of input must not be 0"));
    +    OP_REQUIRES(
    +        context, in_depth != 0,
    +        errors::InvalidArgument("Depth dimension of input must not be 0"));
     
         constexpr int tensor_in_and_out_dims = 4;
         // Transform orig_input_tensor_shape into TensorShape
    

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.