Validate TreeEnsemble v5 node references (#32031)
This pull request improves the robustness and error handling of the
TreeEnsemble implementation in ONNX Runtime. It introduces stricter
validation for tree structure attributes, adds cycle detection, and
expands the test suite to cover more invalid input scenarios.
**Validation and error handling improvements:**
* Added checks to ensure `tree_roots` only contains valid node indices,
preventing out-of-range root references.
* Added comprehensive validation for node and leaf indices within the
tree traversal, including checks for out-of-range indices and missing
required node data.
* Introduced cycle and shared node detection by tracking visited nodes
during traversal, enforcing that each internal node is only visited
once.
[[1]](diffhunk://#diff-2b4c3aa0fba01debf9814c19f34ee80759e62f8ea9ce4a28fa05bdd27ebd4e7eR309)
[[2]](diffhunk://#diff-2b4c3aa0fba01debf9814c19f34ee80759e62f8ea9ce4a28fa05bdd27ebd4e7eR323-R351)
**Test coverage enhancements:**
* Added the `RunInvalidTreeStructureTest` helper and new test cases to
verify the operator correctly rejects out-of-range roots, out-of-range
child nodes, and cycles in the tree structure.
[[1]](diffhunk://#diff-9bce50df70fddc092ce6fc5351812c621343f682a15ca178c34e6dd9415e9a39R139-R167)
[[2]](diffhunk://#diff-9bce50df70fddc092ce6fc5351812c621343f682a15ca178c34e6dd9415e9a39R389-R400)