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

Null pointer dereference via invalid Ragged Tensors

CVE-2021-29516

Description

TensorFlow is an end-to-end open source platform for machine learning. Calling tf.raw_ops.RaggedTensorToVariant with arguments specifying an invalid ragged tensor results in a null pointer dereference. The implementation of RaggedTensorToVariant operations(https://github.com/tensorflow/tensorflow/blob/904b3926ed1c6c70380d5313d282d248a776baa1/tensorflow/core/kernels/ragged_tensor_to_variant_op.cc#L39-L40) does not validate that the ragged tensor argument is non-empty. Since batched_ragged contains no elements, batched_ragged.splits is a null vector, thus batched_ragged.splits(0) will result in dereferencing nullptr. 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
b055b9c474cd

Fix `tf.raw_ops.RaggedTensorToVariant` invalid resize.

https://github.com/tensorflow/tensorflowAmit PatankarApr 13, 2021via ghsa
1 file changed · +5 0
  • tensorflow/core/kernels/ragged_tensor_to_variant_op.cc+5 0 modified
    @@ -159,6 +159,11 @@ class RaggedTensorToVariantOp : public OpKernel {
     
         // Unbatch the Ragged Tensor and encode the components.
         std::vector<RaggedTensorVariant> unbatched_ragged_input;
    +    auto batched_splits_top_vec =
    +        batched_ragged_input.splits(0).vec<SPLIT_TYPE>();
    +    int num_components = batched_splits_top_vec.size() - 1;
    +    OP_REQUIRES(context, num_components >= 0,
    +                errors::Internal("Invalid split argument."));
         OP_REQUIRES_OK(context, UnbatchRaggedZerothDim<VALUE_TYPE, SPLIT_TYPE>(
                                     batched_ragged_input, &unbatched_ragged_input));
     
    

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.