VYPR
Moderate severityNVD Advisory· Published Sep 25, 2020· Updated Aug 4, 2024

Segfault in Tensorflow

CVE-2020-15190

Description

In Tensorflow before versions 1.15.4, 2.0.3, 2.1.2, 2.2.1 and 2.3.1, the tf.raw_ops.Switch operation takes as input a tensor and a boolean and outputs two tensors. Depending on the boolean value, one of the tensors is exactly the input tensor whereas the other one should be an empty tensor. However, the eager runtime traverses all tensors in the output. Since only one of the tensors is defined, the other one is nullptr, hence we are binding a reference to nullptr. This is undefined behavior and reported as an error if compiling with -fsanitize=null. In this case, this results in a segmentation fault The issue is patched in commit da8558533d925694483d2c136a9220d6d49d843c, and is released in TensorFlow versions 1.15.4, 2.0.3, 2.1.2, 2.2.1, or 2.3.1.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
< 1.15.41.15.4
tensorflowPyPI
>= 2.0.0, < 2.0.32.0.3
tensorflowPyPI
>= 2.1.0, < 2.1.22.1.2
tensorflowPyPI
>= 2.2.0, < 2.2.12.2.1
tensorflowPyPI
>= 2.3.0, < 2.3.12.3.1
tensorflow-cpuPyPI
< 1.15.41.15.4
tensorflow-cpuPyPI
>= 2.0.0, < 2.0.32.0.3
tensorflow-cpuPyPI
>= 2.1.0, < 2.1.22.1.2
tensorflow-cpuPyPI
>= 2.2.0, < 2.2.12.2.1
tensorflow-cpuPyPI
>= 2.3.0, < 2.3.12.3.1
tensorflow-gpuPyPI
< 1.15.41.15.4
tensorflow-gpuPyPI
>= 2.0.0, < 2.0.32.0.3
tensorflow-gpuPyPI
>= 2.1.0, < 2.1.22.1.2
tensorflow-gpuPyPI
>= 2.2.0, < 2.2.12.2.1
tensorflow-gpuPyPI
>= 2.3.0, < 2.3.12.3.1

Affected products

1

Patches

1
da8558533d92

Fix undefined behavior in `tf.raw_ops.Switch` in eager mode.

https://github.com/tensorflow/tensorflowMihai MaruseacSep 19, 2020via ghsa
2 files changed · +14 1
  • tensorflow/core/common_runtime/eager/kernel_and_device.cc+6 1 modified
    @@ -308,7 +308,12 @@ Status KernelAndDeviceOp::Run(
       if (outputs != nullptr) {
         outputs->clear();
         for (int i = 0; i < context.num_outputs(); ++i) {
    -      outputs->push_back(Tensor(*context.mutable_output(i)));
    +      const auto* output_tensor = context.mutable_output(i);
    +      if (output_tensor != nullptr) {
    +        outputs->push_back(Tensor(*output_tensor));
    +      } else {
    +        outputs->push_back(Tensor());
    +      }
         }
       }
       return Status::OK();
    
  • tensorflow/python/kernel_tests/control_flow_ops_py_test.py+8 0 modified
    @@ -4579,6 +4579,14 @@ def testUInt64SwitchMerge(self):
           result = control_flow_ops.merge([v_f, v_t])
           self.evaluate(result)
     
    +  def testSwitchEagerMode(self):
    +    if not context.executing_eagerly():
    +      return
    +    input_data = [1, 2, 3, 4]
    +    vf, vt = control_flow_ops.switch(input_data, False)
    +    self.assertAllEqual(vf, input_data)
    +    self.assertAllEqual(vt, [])
    +
       @test_util.run_deprecated_v1
       def testQIntArgAndRet(self):
     
    

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

9

News mentions

0

No linked articles in our index yet.