Skip to content

Add diagnostic context to ORT_ENFORCE bounds checks in TreeEnsemble operators#27678

Merged
xadupre merged 2 commits intoxadupre/tree110413from
copilot/sub-pr-27677
Mar 26, 2026
Merged

Add diagnostic context to ORT_ENFORCE bounds checks in TreeEnsemble operators#27678
xadupre merged 2 commits intoxadupre/tree110413from
copilot/sub-pr-27677

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 16, 2026

Description

Adds informative error messages to the three ORT_ENFORCE index-bounds checks in tree_ensemble_common.h that validate target_class_ids, target_class_weights, and target_class_weights_as_tensor accesses. Each message now surfaces the failing index i and the container size, e.g.:

Index i=5 is out of bounds for target_class_ids (size=3)
Index i=5 is out of bounds for target_class_weights (size=3)
Index i=5 is out of bounds for target_class_weights_as_tensor (size=3)

Motivation and Context

The original bare ORT_ENFORCE(i < ...) calls produced opaque failures with no indication of which attribute was malformed or what the actual index/size values were. This made it difficult to diagnose invalid or adversarial models. Addresses feedback from #27677.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…common.h

Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on adding ORT_ENFORCE in TreeEnsemble operators PR Add diagnostic context to ORT_ENFORCE bounds checks in TreeEnsemble operators Mar 16, 2026
Copilot AI requested a review from xadupre March 16, 2026 16:24
@xadupre xadupre marked this pull request as ready for review March 26, 2026 16:20
@xadupre xadupre merged commit 9d02e4c into xadupre/tree110413 Mar 26, 2026
9 of 10 checks passed
@xadupre xadupre deleted the copilot/sub-pr-27677 branch March 26, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants