Copybara import of the project:#10640
Merged
Merged
Conversation
The x32 unpooling microkernels copy each channel to output[index[c]], where index is the caller-supplied index map and output is the per-pixel indirection slice holding exactly kernel_elements pointers. The index value was used to select an output pointer with no check that it is less than kernel_elements, so an out-of-range index reads a pointer past the indirection buffer and then writes the input element through that out-of-bounds pointer (heap out-of-bounds read of the pointer table plus a write through an attacker-influenced wild pointer). Guard each index against the number of output pointers and drop values that fall outside it, in all four variants (scalar, neon, sse2, wasmsimd). Valid unpooling indices (produced by argmax pooling) are always < kernel_elements, so well-formed input is unaffected; the output is pre-initialized with the fill value, so a dropped index simply leaves that location at fill.
PiperOrigin-RevId: 941635300
7aaabaf to
d7d90f9
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.
Copybara import of the project:
--
cc87074 by evilgensec evil.gen.sec@gmail.com:
x32-unpool: bound the index map before dereferencing the output pointers
The x32 unpooling microkernels copy each channel to output[index[c]],
where index is the caller-supplied index map and output is the per-pixel
indirection slice holding exactly kernel_elements pointers. The index
value was used to select an output pointer with no check that it is less
than kernel_elements, so an out-of-range index reads a pointer past the
indirection buffer and then writes the input element through that
out-of-bounds pointer (heap out-of-bounds read of the pointer table plus
a write through an attacker-influenced wild pointer).
Guard each index against the number of output pointers and drop values
that fall outside it, in all four variants (scalar, neon, sse2,
wasmsimd). Valid unpooling indices (produced by argmax pooling) are
always < kernel_elements, so well-formed input is unaffected; the output
is pre-initialized with the fill value, so a dropped index simply leaves
that location at fill.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#10454 from evilgensec:fix/unpool-index-bounds cc87074