Repository navigation
More input checks for roi ops - #9684
Merged
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9684
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 7e05b8d with merge base 094310d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ousamabenyounes
added a commit
to ousamabenyounes/vision
that referenced
this pull request
Oct 19, 2026
Resolve the conflict with pytorch#9684 in roi_align_kernel.cpp: keep the new batch index range check (it already rejects a non-finite batch index before the int cast) and guard only the four coordinates with std::isfinite after it. Move the batch index column out of the coordinate regression test into a test asserting the range check error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ousamabenyounes
added a commit
to ousamabenyounes/vision
that referenced
this pull request
Oct 19, 2026
Finite float16 coordinates can still overflow to an infinite ROI size, either through x2 - x1 or through the spatial_scale product, and reach the same NaN sample points and garbage int cast. Checking the computed ROI width and height covers both non-finite coordinates and overflow. Drop the batch index test: that case is now rejected by the range check added in pytorch#9684 and already covered by its tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
NicolasHug
added a commit
to NicolasHug/vision
that referenced
this pull request
Nov 3, 2026
pytorch#9684 added a check that the roi_align sampling grid (grid_h * grid_w * pooled_h * pooled_w) fits in an int, because the product sizes the pre_calc buffer: a large sampling_ratio (or a large RoI in adaptive mode) wraps it and leads to an out-of-bounds write. The quantized CPU kernel (qroi_align) has the same buffer and was not covered. This adds the same check there. It also moves the check in roi_align above the `count` computation, since `roi_bin_grid_h * roi_bin_grid_w` can already overflow (signed overflow is UB, and UBSan flags it) before the check runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.