Add validity check on MaxUnpool indicies. (#27432)
### Description
<!-- Describe your changes. -->
Check indices values are valid.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Fix invalid write.