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

Segfault in tf.raw_ops.ImmutableConst

CVE-2021-29539

Description

TensorFlow is an end-to-end open source platform for machine learning. Calling tf.raw_ops.ImmutableConst(https://www.tensorflow.org/api_docs/python/tf/raw_ops/ImmutableConst) with a dtype of tf.resource or tf.variant results in a segfault in the implementation as code assumes that the tensor contents are pure scalars. We have patched the issue in 4f663d4b8f0bec1b48da6fa091a7d29609980fa4 and will release TensorFlow 2.5.0 containing the patch. TensorFlow nightly packages after this commit will also have the issue resolved. If using tf.raw_ops.ImmutableConst in code, you can prevent the segfault by inserting a filter for the dtype argument.

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
4f663d4b8f0b

Allowlist certain data types to avoid a seg fault.

https://github.com/tensorflow/tensorflowAmit PatankarFeb 8, 2021via ghsa
1 file changed · +5 0
  • tensorflow/core/kernels/immutable_constant_op.cc+5 0 modified
    @@ -17,6 +17,8 @@ limitations under the License.
     
     #include <unordered_set>
     
    +#include "tensorflow/core/framework/types.pb.h"
    +
     namespace tensorflow {
     
     namespace {
    @@ -86,6 +88,9 @@ ImmutableConstantOp::ImmutableConstantOp(OpKernelConstruction* context)
       OP_REQUIRES_OK(context,
                      context->GetAttr(kMemoryRegionNameAttr, &region_name_));
       OP_REQUIRES_OK(context, context->GetAttr(kDTypeAttr, &dtype_));
    +  OP_REQUIRES(context, dtype_ != DT_RESOURCE && dtype_ != DT_VARIANT,
    +              errors::InvalidArgument(
    +                  "Resource and variant dtypes are invalid for this op."));
       OP_REQUIRES_OK(context, context->GetAttr(kShapeAttr, &shape_));
     }
     
    

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.