Repository navigation
Harden operator creation and reshape against null dereference and overflow - #11484
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
anagnorisis2peripeteia wants to merge 1 commit into
anagnorisis2peripeteia wants to merge 1 commit into
Conversation
anagnorisis2peripeteia
force-pushed
the
operator-lifecycle-validation-hardening
branch
from
October 2, 2026 17:23
7b7c7b4 to
6c32319
Compare
anagnorisis2peripeteia
added a commit
to anagnorisis2peripeteia/XNNPACK
that referenced
this pull request
Oct 7, 2026
…erflow Split from google#11484 (operator-lifecycle-validation-hardening) for independent review and landing: google#11459 touches the same reshape function and the hunks interleave.
…verflow reduce-nd split into google#11514: google#11459 touches the same reshape function with interleaving hunks.
anagnorisis2peripeteia
force-pushed
the
operator-lifecycle-validation-hardening
branch
from
October 12, 2026 12:51
6c32319 to
315a68c
Compare
anagnorisis2peripeteia
added a commit
to anagnorisis2peripeteia/XNNPACK
that referenced
this pull request
Oct 12, 2026
…erflow Split from google#11484 (operator-lifecycle-validation-hardening) for independent review and landing: google#11459 touches the same reshape function and the hunks interleave.
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
This PR hardens operator creation and reshape routines across multiple
operators in
src/operators/against null pointer dereferences, integeroverflows in stride, workspace, and reduction calculations, and invalid or
unbounded parameters:
constant-pad-nd:
constant_pad_op_outandpadding_valueinxnn_create_constant_pad_nd_x8/x16/x32before dereferencing.input_shape,pre_paddings, andpost_paddingsinreshape_constant_pad_ndwhennum_dims != 0.slice-nd:
slice_op_outincreate_slice_nd.input_shape,offsets, andsizesinreshape_slice_nd.transpose-nd:
transpose_op_outincreate_transpose_nd.permandinput_shapeinreshape_transpose_nd.input_strideandoutput_stridemultiplications and accumulationagainst integer overflow using
xnn_safe_mul.reduce-nd:
reduce_op_out,params, andcvt_paramsincreate_reduce_nd.num_input_dims,input_shape,num_reduction_axes, andreduction_axesinreshape_reduce_nd.[-num_input_dims, 0).num_output_elements,workspace_size,num_reduction_elements,and
zero_sizeagainst integer overflow usingxnn_safe_mulandxnn_safe_add.Pooling Operators:
argmax-pooling-nhwc,average-pooling-nhwc,max-pooling-nhwc, andunpooling-nhwc.paramspointer whenparams_size != 0inmax-pooling-nhwc.Unit Tests:
null argument pointers, invalid axes, and stride/workspace overflows
across
test/operators/*-test.cc.Testing
build/): 53/53 tests passed.build-ubsan/): 53/53 tests passed with zerosanitizer warnings.