Skip to content

check nchwc_inputs before accessing #25253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

s0md3v
Copy link
Contributor

@s0md3v s0md3v commented Jul 2, 2025

Description

Fixes a build error by checking that nchwc_inputs is not empty before accessing its elements in TransformBinary.

Motivation and Context

Compiler flagged a possible uninitialized access to nchwc_inputs[0] (when empty), causing the build to fail. This check ensures safe access and avoids undefined behavior. No impact on valid graphs.

@tianleiwu
Copy link
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@tianleiwu
Copy link
Contributor

It is false alert since the function is applied to Add, Sum, Mul which shall have at least two inputs.

if (graph_utils::IsSupportedOptypeVersionAndDomain(node, "Add", {7, 13, 14}) ||
graph_utils::IsSupportedOptypeVersionAndDomain(node, "Sum", {6, 8, 13})) {
TransformBinary(node, true);
} else if (graph_utils::IsSupportedOptypeVersionAndDomain(node, "Mul", {7, 13, 14})) {
TransformBinary(node, false);

Anyway, an extra check is fine to me even though not necessary.

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.

2 participants