Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

IsInitializerWithExpectedValue(int64_t) dereferences a null constant initializer

Open Beginner friendly
#32,907 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Yuhx141 is already working on this.

Since Sep 30, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Start with the int64_t IsInitializerWithExpectedValue overload in onnxruntime/core/optimizer/utils.cc and its call from MatchPositionEmbeddingSubgraphsFromGather in embed_layer_norm_fusion.cc. Run reproduce.py from the ORT-SEM-003 reproducer to confirm the crash and compare the int64 path with the float overload. Done means the invalid initializer is handled without SIGSEGV and the reproducer no longer fails under ORT_ENABLE_ALL.

Written by the indexing model from the issue text.

Description

Affected versions

  • Latest stable release tested: v1.30.0 (f2c39fe2f838cf35ce7da92824f5a5e3ee6e88a7)
  • Default-branch build tested: a11b4e593164c82f7ce95efce3693744103f8176

Summary

ORT_ENABLE_ALL terminates the process with SIGSEGV while EmbedLayerNormFusion inspects the now-runtime Range start value.

The source model loads with optimizations disabled. Enabling graph optimization reproduces the failure on ONNX Runtime 1.30.0. Disabling only EmbedLayerNormFusion removes the failure. A compiled 1.31 development wheel based on a11b4e593164c82f7ce95efce3693744103f8176 reproduced the same root. The relevant implementation remains present at official main 96f73115c95968a3f31f2a110b33c164d847dda4.

Steps to reproduce

  1. Clone the public reproducer and enter this case:

    git clone https://github.com/Yuhx141/graph-optimizer-issue-reproducers.git
    cd graph-optimizer-issue-reproducers/onnxruntime/ORT-SEM-003
    
  2. Install the versions in requirements.txt.

  3. Run python reproduce.py.

The standalone script validates the source behavior, reproduces the optimized behavior, and disables the implicated transformer as a positive control. The readable reproducer is at https://github.com/Yuhx141/graph-optimizer-issue-reproducers/tree/main/onnxruntime/ORT-SEM-003.

Expected result

The optimizer must preserve every public value, remaining consumer, graph interface and numerical result of the valid source model, or decline the rewrite.

Actual result

ORT_ENABLE_ALL terminates the process with SIGSEGV while EmbedLayerNormFusion inspects the now-runtime Range start value.

Likely cause and source location

the int64 IsInitializerWithExpectedValue overload receives null from GetConstantInitializer but constructs Initializer from *tensor_proto without the null check present in the float overload.

Relevant source locations:

  • onnxruntime/core/optimizer/utils.cc: int64_t IsInitializerWithExpectedValue
  • onnxruntime/core/optimizer/embed_layer_norm_fusion.cc: MatchPositionEmbeddingSubgraphsFromGather

Environment

  • OS: Ubuntu 24.04.4 LTS, x86-64
  • CPU: Intel Core Ultra 5 225
  • Python: 3.11.16
  • NumPy: 2.4.6
  • ONNX: 1.22.0
  • ONNX Runtime: 1.30.0 (f2c39fe2f838cf35ce7da92824f5a5e3ee6e88a7)
  • Execution provider: CPUExecutionProvider
  • Optimization level: ORT_ENABLE_ALL

Duplicate search

PR #27976 validates empty initializer contents. The int64 overload still lacks the float overload's null TensorProto check.

Reproducer files

Dominant language
C++
Stars
22.2k
Forks
4.4k
Avg merge
3d 3h
Merged PRs (30d)
275

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/onnxruntime

All issues in microsoft/onnxruntime

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.