Skip to content

Copybara import of the project: - #11133

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_975821639
Open

Copybara import of the project:#11133
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_975821639

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Copybara import of the project:

--
041763c by tinhien11 thanhtinpk092007@gmail.com:

subgraph: validate filter shape dims[1..3] in conv/deconv/depthwise-conv

xnn_define_convolution_2d validated only filter_value->shape.dim[0]
(== group_output_channels * groups) but not dims[1..3] against
kernel_height, kernel_width, and group_input_channels. When a filter
tensor is declared with dims[1..3] smaller than the convolution's
kernel parameters, weight packing (xnn_pack_f32_conv_goki_w) reads
nc * ks * kc elements from the filter buffer — where ks comes from
the convolution parameters, not the filter's declared shape — causing
a heap out-of-bounds read during xnn_create_runtime_v2.

xnn_define_deconvolution_2d and xnn_define_depthwise_convolution_2d
had no filter shape validation at all.

Add full 4D filter shape validation to all three operators, rejecting
mismatched shapes at define-time with xnn_status_invalid_parameter.

Fixes #11118

--
c2ec208 by tinhien11 thanhtinpk092007@gmail.com:

subgraph tests: fix filter shapes rejected by define-time validation

The new conv/deconv/depthwise filter shape checks reject the dummy
geometry used by three structural tests that never execute the graph:

  • SUBGRAPH_FP16.convolution_{weights,bias}_used_by_another_node declared
    a 1x1 filter ({2, 1, 1, 3}) against Kernel{3, 3}; use a 1x1 kernel so
    the shapes are self-consistent. Output extents are unchanged.
  • SUBGRAPH_NCHW.bottleneck declared filter Remove redundant #includes #10 as {4, 1, 1, 4} for a
    convolution with group_input_channels=8; use {4, 1, 1, 8}.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11119 from tinhien11:fix/filter-shape-validation c2ec208

--
041763c by tinhien11 <thanhtinpk092007@gmail.com>:

subgraph: validate filter shape dims[1..3] in conv/deconv/depthwise-conv

xnn_define_convolution_2d validated only filter_value->shape.dim[0]
(== group_output_channels * groups) but not dims[1..3] against
kernel_height, kernel_width, and group_input_channels. When a filter
tensor is declared with dims[1..3] smaller than the convolution's
kernel parameters, weight packing (xnn_pack_f32_conv_goki_w) reads
nc * ks * kc elements from the filter buffer — where ks comes from
the convolution parameters, not the filter's declared shape — causing
a heap out-of-bounds read during xnn_create_runtime_v2.

xnn_define_deconvolution_2d and xnn_define_depthwise_convolution_2d
had no filter shape validation at all.

Add full 4D filter shape validation to all three operators, rejecting
mismatched shapes at define-time with xnn_status_invalid_parameter.

Fixes #11118

--
c2ec208 by tinhien11 <thanhtinpk092007@gmail.com>:

subgraph tests: fix filter shapes rejected by define-time validation

The new conv/deconv/depthwise filter shape checks reject the dummy
geometry used by three structural tests that never execute the graph:

- SUBGRAPH_FP16.convolution_{weights,bias}_used_by_another_node declared
  a 1x1 filter ({2, 1, 1, 3}) against Kernel{3, 3}; use a 1x1 kernel so
  the shapes are self-consistent. Output extents are unchanged.
- SUBGRAPH_NCHW.bottleneck declared filter #10 as {4, 1, 1, 4} for a
  convolution with group_input_channels=8; use {4, 1, 1, 8}.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11119 from tinhien11:fix/filter-shape-validation c2ec208
PiperOrigin-RevId: 975821639
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.

Heap buffer overflow read in weight packing when filter shape dims[1..3] mismatch convolution kernel params

1 participant