Skip to content

reject overflowing output dimensions in constant pad reshape#10357

Open
aizu-m wants to merge 1 commit into
google:masterfrom
aizu-m:constant-pad-dim-overflow
Open

reject overflowing output dimensions in constant pad reshape#10357
aizu-m wants to merge 1 commit into
google:masterfrom
aizu-m:constant-pad-dim-overflow

Conversation

@aizu-m
Copy link
Copy Markdown

@aizu-m aizu-m commented May 31, 2026

Each padded output dimension is computed as input_dim + pre_padding + post_padding in size_t with no overflow check (constant-pad-nd.c:188 and static-constant-pad.c:120), so a large padding value wraps the sum to a small dimension that slips past the multiply-only overflow guard in xnn_runtime_tensor_get_size, producing an undersized output tensor. Use xnn_safe_add and reject the reshape when the addition overflows.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 31, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant