Skip to content

Fix TensorScatter CPU security issue - #29916

Merged
nenad1002 merged 4 commits into
mainfrom
nebanfic/fix-tensorscatter-issue
Jul 29, 2026
Merged

Fix TensorScatter CPU security issue#29916
nenad1002 merged 4 commits into
mainfrom
nebanfic/fix-tensorscatter-issue

Conversation

@nenad1002

Copy link
Copy Markdown
Contributor

Description

Fix TensorScatter CPU security issue

Motivation and Context

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a CPU-side safety/security issue in the ONNX TensorScatter operator by restricting kernel registration to fixed-size tensor element types, preventing unsafe raw-buffer operations on non-fixed-size types (e.g., string). It also adds a unit test to validate that string-typed graphs are rejected during kernel resolution.

Changes:

  • Restrict the CPU TensorScatter kernel type constraint from AllTensorTypes() to AllFixedSizeTensorTypes().
  • Add a CPU-only unit test covering string inputs and expecting graph resolution to fail.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
onnxruntime/core/providers/cpu/llm/tensorscatter.cc Tightens the CPU kernel type constraint to fixed-size tensor element types to avoid unsafe raw-memory operations on strings.
onnxruntime/test/providers/cpu/llm/tensorscatter_op_test.cc Adds a regression test that attempts to bind tensor(string) to TensorScatter and expects kernel resolution to fail.

Comment thread onnxruntime/test/providers/cpu/llm/tensorscatter_op_test.cc
@nenad1002
nenad1002 enabled auto-merge (squash) July 28, 2026 18:36
@nenad1002
nenad1002 merged commit 3e5b594 into main Jul 29, 2026
87 checks passed
@nenad1002
nenad1002 deleted the nebanfic/fix-tensorscatter-issue branch July 29, 2026 21:13
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.

3 participants