Aborted (core dumped) in `tf.raw_ops.SparseReduceSum\tf.raw_ops.SparseReduceMax`
@x0w3n,
I tried to execute the mentioned code on tf-nightly and it was not aborted as above, and fails with the same error as the input is very long(Encountered overflow when multiplying). Kindly find the gist of it [here](https://colab.research.google.com/gist/tilakrayal/af41845d49b59bc070b15e61faf5d0ad/untitled1948.ipynb).  Thank you!
### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

tf 2.16

### Custom code

Yes

### OS platform and distribution

Linux Ubuntu 22.04.3 LTS (x86_64)

### Mobile device

_No response_

### Python version

3.9.13

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Under specific input, tf.raw_ops.SparseReduceSum\tf.raw_ops.SparseReduceMax encounters "Aborted (core dumped)".

### Standalone code to reproduce the issue

```shell
import tensorflow as tf

input_dict = {
    'input_indices': tf.constant([[-3, 1, -3], [-2, -4, 2]], dtype=tf.int64),
    'input_values': tf.constant([1, 4], dtype=tf.float64),
    'input_shape': tf.constant([0, 1700000000000, 6000000], dtype=tf.int64),
    'reduction_axes': tf.constant([0], dtype=tf.int32),
    'keep_dims': False
}
# crash
tf.raw_ops.SparseReduceSum(
   **input_dict
)

# crash
# tf.raw_ops.SparseReduceMax(
#    **input_dict
# )
```


### Relevant log output

```shell
2024-06-10 12:47:47.733403: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-06-10 12:47:48.724820: F tensorflow/core/framework/tensor_shape.cc:201] Non-OK-status: InitDims(dim_sizes) status: INVALID_ARGUMENT: Encountered overflow when multiplying 1700000000000 with 6000000, result: -8246744073709551616
Aborted (core dumped)
```
