TensorFlow is an open source platform for machine learning. In affected versions the Keras pooling layers can trigger a segfault if the size of the pool is 0 or if a dimension is negative. This is due to the TensorFlow's implementation of pooling operations where the values in the sliding window are not checked to be strictly positive. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*
455FB550-4C9C-4BD6-9F76-A627B62AB332
2.4.4
cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*
035CDF63-1548-4FB4-B8A9-B8D328FAF910
2.5.2
2.5.0
cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*
5D68D8D1-DB27-4395-9D3D-2BED901B852C
2.6.1
2.6.0
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): Linux Ubuntu 18.04
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: n/a
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 2.6.0
- Python version: 3.6.8
- Bazel version (if compiling from source): n/a
- GCC/Compiler version (if compiling from source): n/a
- CUDA/cuDNN version: n/a
- GPU model and memory: n/a

**Describe the current behavior**
`tf.keras.layers.MaxPooling3D` crashes when `pool_size` contains `0`, and outputs a all-inf tensor when `pool_size` contains negative values.

**Describe the expected behavior**
Expect a `ValueError` to be thrown if the input `pool_size` contains zero or negative values.


**Standalone code to reproduce the issue**
If the `pool_size` has `0`:
```
import tensorflow as tf
pool_size = [2, 2, 0]
layer = tf.keras.layers.MaxPooling3D(strides=1, pool_size=pool_size)
input_tensor = tf.random.uniform([3, 4, 10, 11, 12], dtype=tf.float32)
res = layer(input_tensor) # crash
```
Outputs:
```
Floating point exception (core dumped)
```
If the `pool_size` has negative values:
```
import tensorflow as tf
pool_size = [2, 2, -2]
layer = tf.keras.layers.MaxPooling3D(strides=1, pool_size=pool_size,)
input_tensor = tf.random.uniform([3, 4, 10, 11, 12], dtype=tf.float32)
res = layer(input_tensor)
print(res)
```
The output is a tensor with `shape`=`(3, 3, 9, 14, 12)` and all `inf` values.
tf.keras.layers.MaxPooling3D crashes
This is a GitHub Issue
repo:tensorflow
owner:tensorflow
Title : tf.keras.layers.MaxPooling3D 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): Linux Ubuntu 18.04
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: n/a
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 2.6.0
- Python version: 3.6.8
- Bazel version (if compiling from source): n/a
- GCC/Compiler version (if compiling from source): n/a
- CUDA/cuDNN version: n/a
- GPU model and memory: n/a

**Describe the current behavior**
`tf.keras.layers.MaxPooling3D` crashes when `pool_size` contains `0`, and outputs a all-inf tensor when `pool_size` contains negative values.

**Describe the expected behavior**
Expect a `ValueError` to be thrown if the input `pool_size` contains zero or negative values.


**Standalone code to reproduce the issue**
If the `pool_size` has `0`:
```
import tensorflow as tf
pool_size = [2, 2, 0]
layer = tf.keras.layers.MaxPooling3D(strides=1, pool_size=pool_size)
input_tensor = tf.random.uniform([3, 4, 10, 11, 12], dtype=tf.float32)
res = layer(input_tensor) # crash
```
Outputs:
```
Floating point exception (core dumped)
```
If the `pool_size` has negative values:
```
import tensorflow as tf
pool_size = [2, 2, -2]
layer = tf.keras.layers.MaxPooling3D(strides=1, pool_size=pool_size,)
input_tensor = tf.random.uniform([3, 4, 10, 11, 12], dtype=tf.float32)
res = layer(input_tensor)
print(res)
```
The output is a tensor with `shape`=`(3, 3, 9, 14, 12)` and all `inf` values.
--- end body ---

comments :
--- start comments ---

--- end comments ---