C++ API `SparseFillEmptyRows` can lead to `std::length_error`
Hi @Sehun0819 ,

Thanks for reporting. The `dense_shape` can be 1D which means it can have -ve shapes like [-2,3] & [2,-3]. I would like to know the behaviour with the mentioned 2 shapes. It would be appreciated if you test by modifying the Inputs accordingly and report the behaviour.
Thanks!
### Issue type

Bug

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

Yes

### Source

source

### TensorFlow version

tf 2.17

### Custom code

Yes

### OS platform and distribution

Linux Ubuntu 22.04 LTS

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

6.5.0

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

C++ API `SparseFillEmptyRows` can lead to `std::length_error`.
Error location is [here](https://github.com/tensorflow/tensorflow/blob/9da417e3f63215efe995b83e7b9f9b34115a424e/tensorflow/core/kernels/fill_empty_rows_functor.h#L114C36-L114C46):
```C++
    std::vector<Tindex> csr_offset(dense_rows, 0);
```
Because lack of checking negativity, negative value of `dense_rows` is fed to the constructor of `std::vector`. By integer underflow, the value is converted to extremely large number and it ends up with `std::length_error`.

### Standalone code to reproduce the issue

```C++
#include "tensorflow/cc/framework/scope.h"
#include "tensorflow/core/graph/graph.h"
#include "tensorflow/core/public/session.h"
#include "tensorflow/cc/ops/array_ops.h"
#include "tensorflow/cc/ops/standard_ops.h"

using namespace tensorflow;

int main() {
  SessionOptions options;
  std::unique_ptr<tensorflow::Session>
    session(tensorflow::NewSession(options));
  Scope scope = Scope::NewRootScope();

  Input indices = {{1l}};
  Input values = {1};
  Input dense_shape = {-1l};
  Input default_value = 1;
  auto target = ops::SparseFillEmptyRows(scope.WithOpName("target"), indices, values, dense_shape, default_value);

  Status status;
  GraphDef graph_def;
  status = scope.ToGraphDef(&graph_def);
  if (!status.ok()) {
    LOG(WARNING) << "Could not build graph: " << status.message();
  }

  status = session->Create(graph_def);
  if (!status.ok()) {
    LOG(WARNING) << "Could not create session: " << status.message();
  }

  std::vector<Tensor> outputs;
  status = session->Run({}, {"target"}, {"target"}, &outputs);
  if (!status.ok()) {
    LOG(WARNING) << "Could not run session: " << status.message();
  }

  return 0;
}
```


### Relevant log output

```shell
terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()
Aborted (core dumped)
```
