Additional validation in LSTM and DynamicQuantizedLSTM (#29595)
### Description
<!-- Describe your changes. -->
Validate weights against hidden_size attribute for LSTM and
DynamicQuantizedLSTM to prevent OOB heap read
### 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. -->
MSRC 125531
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>