OOB write in PlanAllocations
I'll go ahead and make this change, 

There is a bigger question, 

1.  Can we make  graph_info_->outputs() as well as similar constructions (graph_info_->variables(), graph_info_->inputs(), etc.) not externally controllable?
2. If not, then we need to cover those cases as well. I'm making this an assert so that the program will throw an exception in this case, as we shouldn't continue if this condition is reached. Please don't report vulnerabilities publicly! Hi @SiriusHsh 

As this [comment](https://github.com/tensorflow/tensorflow/issues/60620#issuecomment-1553442519) suggests, please consult https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md#vulnerabilities-in-tensorflow and follow rules for responsible disclosure.

Thanks. Hi @pjpratik 
Actually, The Google Bug Hunter Team suggested that I should open an issue on Github for these few problems. I don't we'd ask for that for this specific issue. Hi @SiriusHsh, this is now fixed in the following commit: https://github.com/tensorflow/tensorflow/commit/c4d31b0f488f02fa7fe1bbccf3f75b34d651cf3a please test in master or nightly and let us know if it resolves your issue. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60620">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60620">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

tf 2.14.0

### Custom Code

No

### OS Platform and Distribution

Ubuntu 18.04.6

### Mobile device

_No response_

### Python version

Python 3.8.3

### Bazel version

bazel 5.3.0

### GCC/Compiler version

gcc 7.5.0

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

The `graph_info_->outputs` are externally controllable data, which may cause the `tensor_index` value to be `-1`, leading to an out-of-bounds write in the vector.

```
// simple_planner.c
TfLiteStatus ArenaPlanner::PlanAllocations() {

  ...
  
  // Keeps track of references to each tensor.
  std::vector<int> refcounts(num_tensors, 0);
  
  ...

  // We must make sure the output tensors are never overwritten. We do that by
  // artificially adding one to their ref-counts so they are never selected
  // for deallocation.
  for (int tensor_index : graph_info_->outputs()) {
    refcounts[tensor_index]++;     
  }

```

Due to an out-of-bounds write of 8 bytes forward, the original chunk size increases from` 0x20` to `0x100000021`, which corrupts the chunk structure. As a result, when the `PlanAllocations` function finishes and returns, triggering the vector's destructor, the chunk is freed, causing a security check in the glibc `_int_free` function to be triggered.

```c
nextchunk = chunk_at_offset(p, size);

/* Or whether the next chunk is beyond the boundaries of the arena.  */
if (__builtin_expect (contiguous (av)
          && (char *) nextchunk
          >= ((char *) av->top + chunksize(av->top)), 0))   
malloc_printerr ("double free or corruption (out)");
```

[arena_planner_PlanAllocations_heap_overflow.zip](https://github.com/tensorflow/tensorflow/files/11503599/arena_planner_PlanAllocations_heap_overflow.zip)


### Standalone code to reproduce the issue

```shell
When I use the benchmark tool for PoC validation, it causes the TensorFlow Lite inference process to be subjected to a DOS（coredump).


❯ ./benchmark_model --graph=arena_planner_PlanAllocations_heap_overflow.tflite
INFO: STARTING!
INFO: Log parameter values verbosely: [0]
INFO: Graph: [arena_planner_PlanAllocations_heap_overflow.tflite]
INFO: Loaded model arena_planner_PlanAllocations_heap_overflow.tflite
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
double free or corruption (out)
[1]    30982 abort (core dumped)  ./benchmark_model --graph=arena_planner_PlanAllocations_heap_overflow.tflite
```
```


### Relevant log output

_No response_</details>