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

Heap buffer overflow in `Conv3DBackprop*`

CVE-2021-29520

Description

TensorFlow is an end-to-end open source platform for machine learning. Missing validation between arguments to tf.raw_ops.Conv3DBackprop* operations can result in heap buffer overflows. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/4814fafb0ca6b5ab58a09411523b2193fed23fed/tensorflow/core/kernels/conv_grad_shape_utils.cc#L94-L153) assumes that the input, filter_sizes and out_backprop tensors have the same shape, as they are accessed in parallel. 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
8f37b52e1320

Validate some shape requirements for `Conv3DBackpropFilter*` and `Conv3DBackpropInput*` ops.

https://github.com/tensorflow/tensorflowMihai MaruseacApr 19, 2021via ghsa
1 file changed · +56 0
  • tensorflow/core/kernels/conv_grad_ops_3d.cc+56 0 modified
    @@ -239,6 +239,20 @@ class Conv3DBackpropInputOp : public OpKernel {
           input_shape = context->input(0).shape();
         }
     
    +    OP_REQUIRES(
    +        context, input_shape.dim_size(4) == filter_shape.dim_size(3),
    +        errors::InvalidArgument("input and filter_sizes must have the same "
    +                                "number of channels. Got ",
    +                                input_shape.dim_size(4), " for input and ",
    +                                filter_shape.dim_size(3), " for filter_sizes"));
    +    OP_REQUIRES(
    +        context, out_backprop_shape.dim_size(4) == filter_shape.dim_size(4),
    +        errors::InvalidArgument("out_backprop and filter_sizes must have the "
    +                                "same number of channels. Got ",
    +                                out_backprop_shape.dim_size(4),
    +                                " for out_backprop and ",
    +                                filter_shape.dim_size(4), " for filter_sizes"));
    +
         ConvBackpropDimensions dims;
         OP_REQUIRES_OK(context, ConvBackpropComputeDimensions(
                                     "Conv3DBackpropInputOp", /*num_spatial_dims=*/3,
    @@ -346,6 +360,20 @@ class Conv3DCustomBackpropInputOp : public OpKernel {
           input_shape = context->input(0).shape();
         }
     
    +    OP_REQUIRES(
    +        context, input_shape.dim_size(4) == filter_shape.dim_size(3),
    +        errors::InvalidArgument("input and filter_sizes must have the same "
    +                                "number of channels. Got ",
    +                                input_shape.dim_size(4), " for input and ",
    +                                filter_shape.dim_size(3), " for filter_sizes"));
    +    OP_REQUIRES(
    +        context, out_backprop_shape.dim_size(4) == filter_shape.dim_size(4),
    +        errors::InvalidArgument("out_backprop and filter_sizes must have the "
    +                                "same number of channels. Got ",
    +                                out_backprop_shape.dim_size(4),
    +                                " for out_backprop and ",
    +                                filter_shape.dim_size(4), " for filter_sizes"));
    +
         ConvBackpropDimensions dims;
         OP_REQUIRES_OK(context, ConvBackpropComputeDimensions(
                                     "Conv3DBackpropInputOp", /*num_spatial_dims=*/3,
    @@ -696,6 +724,20 @@ class Conv3DBackpropFilterOp : public OpKernel {
           filter_shape = context->input(1).shape();
         }
     
    +    OP_REQUIRES(
    +        context, input_shape.dim_size(4) == filter_shape.dim_size(3),
    +        errors::InvalidArgument("input and filter_sizes must have the same "
    +                                "number of channels. Got ",
    +                                input_shape.dim_size(4), " for input and ",
    +                                filter_shape.dim_size(3), " for filter_sizes"));
    +    OP_REQUIRES(
    +        context, out_backprop_shape.dim_size(4) == filter_shape.dim_size(4),
    +        errors::InvalidArgument("out_backprop and filter_sizes must have the "
    +                                "same number of channels. Got ",
    +                                out_backprop_shape.dim_size(4),
    +                                " for out_backprop and ",
    +                                filter_shape.dim_size(4), " for filter_sizes"));
    +
         ConvBackpropDimensions dims;
         OP_REQUIRES_OK(context,
                        ConvBackpropComputeDimensions(
    @@ -808,6 +850,20 @@ class Conv3DCustomBackpropFilterOp : public OpKernel {
           filter_shape = context->input(1).shape();
         }
     
    +    OP_REQUIRES(
    +        context, input_shape.dim_size(4) == filter_shape.dim_size(3),
    +        errors::InvalidArgument("input and filter_sizes must have the same "
    +                                "number of channels. Got ",
    +                                input_shape.dim_size(4), " for input and ",
    +                                filter_shape.dim_size(3), " for filter_sizes"));
    +    OP_REQUIRES(
    +        context, out_backprop_shape.dim_size(4) == filter_shape.dim_size(4),
    +        errors::InvalidArgument("out_backprop and filter_sizes must have the "
    +                                "same number of channels. Got ",
    +                                out_backprop_shape.dim_size(4),
    +                                " for out_backprop and ",
    +                                filter_shape.dim_size(4), " for filter_sizes"));
    +
         ConvBackpropDimensions dims;
         OP_REQUIRES_OK(context,
                        ConvBackpropComputeDimensions(
    

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.