TensorFlow is an open source platform for machine learning. Prior to versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4, the `tf.compat.v1.signal.rfft2d` and `tf.compat.v1.signal.rfft3d` lack input validation and under certain condition can result in crashes (due to `CHECK`-failures). Versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4 contain a patch for this issue.
cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*
D9359D32-D090-44CF-AC43-2046084A28BB
2.6.4
cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*
C4DFBF2D-5283-42F6-8800-D653BFA5CE82
2.7.2
2.7.0
cpe:2.3:a:google:tensorflow:2.7.0:rc0:*:*:*:*:*:*
A58EDA5C-66D6-46F1-962E-60AFB7C784A7
cpe:2.3:a:google:tensorflow:2.7.0:rc1:*:*:*:*:*:*
89522760-C2DF-400D-9624-626D8F160CBA
cpe:2.3:a:google:tensorflow:2.8.0:-:*:*:*:*:*:*
E9EA1898-ACAA-4699-8BAE-54D62C1819FB
cpe:2.3:a:google:tensorflow:2.8.0:rc0:*:*:*:*:*:*
130DE3C9-6842-456F-A259-BF8FF8457217
cpe:2.3:a:google:tensorflow:2.8.0:rc1:*:*:*:*:*:*
BBF2FCEF-989C-409D-9F4C-81418C65B972
cpe:2.3:a:google:tensorflow:2.9.0:rc0:*:*:*:*:*:*
9CFB1CFC-579D-4647-A472-6DE8BE1951DE
cpe:2.3:a:google:tensorflow:2.9.0:rc1:*:*:*:*:*:*
F3F3F37E-D27F-4060-830C-0AFF16150777
OR
**System information**
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): N/A
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 2.8.0
- Python version:3.7.12
- Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- CUDA/cuDNN version: 11.2 (based on a colab notebook)
- GPU model and memory: Tesla T4, 15109MiB (based on a colab notebook)

**Describe the current behavior**

The following code snippets lead to crashes when executed:

```
import numpy as np
import tensorflow as tf

a = np.empty([6, 0])
b = np.array([1, -1])
try:
  tf.compat.v1.signal.rfft2d(input_tensor=a,fft_length=b)
  # on a different machine: Check failed: size >= 0 (-9223372036854775808 vs. 0)
  # Aborted (core dumped)
except:
  pass

print('execution does not reach this line')
```

and

```
import numpy as np
import tensorflow as tf

a = np.empty([6, 1, 1])
b = np.array([1, 2, 0])

try:
  tf.compat.v1.signal.irfft3d(input_tensor=a,fft_length=b)
  # on a different machine: failed to initialize batched cufft plan with customized allocator: Failed to make cuFFT batched plan.
  # Aborted (core dumped)
except:
  pass
print('execution does not reach this line')
```

In either case, the inputs do not quite make sense, and tensorflow should throw.

**Describe the expected behavior**

Tensorflow should throw exceptions instead of crashing.

**[Contributing](https://www.tensorflow.org/community/contribute)**

- Do you want to contribute a PR? (yes/no):
- Briefly describe your candidate solution(if contributing):

**Standalone code to reproduce the issue**

Here is a colab notebook:
https://colab.research.google.com/drive/168jYG6MqnW4jpJdIXFMUBkyiaweA43aP?usp=sharing
Edit: the notebook has to be run with GPU 

The code snippets above should also reproduce the issue.


`tf.compat.v1.signal.rfft2d` and `rfft3d` lacks input validation leading to crashes
This is a GitHub Issue
repo:tensorflow
owner:tensorflow
Title : `tf.compat.v1.signal.rfft2d` and `rfft3d` lacks input validation leading to crashes
Issue date:

--- start body ---
**System information**
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): N/A
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 2.8.0
- Python version:3.7.12
- Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- CUDA/cuDNN version: 11.2 (based on a colab notebook)
- GPU model and memory: Tesla T4, 15109MiB (based on a colab notebook)

**Describe the current behavior**

The following code snippets lead to crashes when executed:

```
import numpy as np
import tensorflow as tf

a = np.empty([6, 0])
b = np.array([1, -1])
try:
  tf.compat.v1.signal.rfft2d(input_tensor=a,fft_length=b)
  # on a different machine: Check failed: size >= 0 (-9223372036854775808 vs. 0)
  # Aborted (core dumped)
except:
  pass

print('execution does not reach this line')
```

and

```
import numpy as np
import tensorflow as tf

a = np.empty([6, 1, 1])
b = np.array([1, 2, 0])

try:
  tf.compat.v1.signal.irfft3d(input_tensor=a,fft_length=b)
  # on a different machine: failed to initialize batched cufft plan with customized allocator: Failed to make cuFFT batched plan.
  # Aborted (core dumped)
except:
  pass
print('execution does not reach this line')
```

In either case, the inputs do not quite make sense, and tensorflow should throw.

**Describe the expected behavior**

Tensorflow should throw exceptions instead of crashing.

**[Contributing](https://www.tensorflow.org/community/contribute)**

- Do you want to contribute a PR? (yes/no):
- Briefly describe your candidate solution(if contributing):

**Standalone code to reproduce the issue**

Here is a colab notebook:
https://colab.research.google.com/drive/168jYG6MqnW4jpJdIXFMUBkyiaweA43aP?usp=sharing
Edit: the notebook has to be run with GPU 

The code snippets above should also reproduce the issue.


--- end body ---

comments :
--- start comments ---

--- end comments ---