[operators] Guard max-pooling-nhwc padding arithmetic overflow - #11409
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
anagnorisis2peripeteia wants to merge 1 commit into
anagnorisis2peripeteia wants to merge 1 commit into
Conversation
Reshape computed the effective kernel size, TF-SAME padding, and the padded input size with raw size_t arithmetic. A large pooling window times dilation wraps the effective kernel to a small value, so the output dimension is computed from a wrapped padded input size and the indirection buffer addresses input pixels outside the input tensor. Compute each term with checked helpers, and reject padding that does not fit the uint32_t operator fields.
anagnorisis2peripeteia
force-pushed
the
maxpool-dimension-followup
branch
from
September 26, 2026 01:06
cec89d5 to
67f5b27
Compare
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.
Summary
reshape_max_pooling2d_nhwccomputed the effective kernel size, the TF-SAMEpadding, and the padded input size with raw
size_tarithmetic.pooling_window * dilationproduct wraps the effective kernel to asmall value, so the output dimension is computed from a wrapped padded input
size.
which is an out-of-bounds read at run time.
uint32_twith no range check.What changed
arithmetic, and reject padding above
UINT32_MAX.dimension calculation.
xnn_status_out_of_memoryand log the failing term on each overflow.Testing
max-pooling-nhwc-testpasses, including the newpadded_input_height_overflowcase.Notes
This is independent of #11270, which covers the max-pooling stride arithmetic
in the unpooling path. This PR covers the padding path only.