Skip to content

Initialize nowactiveatlower in ratiotest_textbook - #2778

Merged
jajhall merged 1 commit into
ERGO-Code:latestfrom
stratakis:nowactiveatlower_uninit
Jan 28, 2026
Merged

Initialize nowactiveatlower in ratiotest_textbook#2778
jajhall merged 1 commit into
ERGO-Code:latestfrom
stratakis:nowactiveatlower_uninit

Conversation

@stratakis

Copy link
Copy Markdown
Contributor

The nowactiveatlower field was only set inside the conditional blocks when a limiting constraint was found (alpha_i < result.alpha). If both loops completed without finding a limiting constraint, the field remained uninitialized.

Uncovered by Coverity static analysis

The nowactiveatlower field was only set inside the conditional blocks
when a limiting constraint was found (alpha_i < result.alpha). If both
loops completed without finding a limiting constraint, the field remained
uninitialized.

Uncovered by Coverity static analysis
@stratakis

Copy link
Copy Markdown
Contributor Author

Technically this issue won't manifest, as the only caller I found was here:

stepres.nowactiveatlower

Where limitingconstraint != -1 is checked before accessing nowactiveatlower.

However returning a struct with an unitialized field would be considered undefined behaviour.

Full coverity message ``` 1. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:17:3: var_decl: Declaring variable "result" without initializer. 2. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:22:3: path: Condition "j < p.num_nz", taking true branch. 3. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:26:5: path: Condition "alpha_i < result.alpha", taking false branch. 4. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:31:3: path: Jumping back to the beginning of the loop. 5. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:22:3: path: Condition "j < p.num_nz", taking true branch. 6. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:26:5: path: Condition "alpha_i < result.alpha", taking false branch. 7. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:31:3: path: Jumping back to the beginning of the loop. 8. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:22:3: path: Condition "j < p.num_nz", taking false branch. 9. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:34:3: path: Condition "j < rowmove.num_nz", taking true branch. 10. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:39:5: path: Condition "alpha_i < result.alpha", taking false branch. 11. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:44:3: path: Jumping back to the beginning of the loop. 12. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:34:3: path: Condition "j < rowmove.num_nz", taking false branch. 13. scipy-1.16.2/subprojects/highs/src/qpsolver/ratiotest.cpp:46:3: uninit_use: Using uninitialized value "result". Field "result.nowactiveatlower" is uninitialized. # 44| } # 45| # 46|-> return result; # 47| } # 48| ```

@codecov

codecov Bot commented Jan 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.32%. Comparing base (28f6dc8) to head (55bc415).
⚠️ Report is 6 commits behind head on latest.

Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #2778      +/-   ##
==========================================
- Coverage   80.32%   80.32%   -0.01%     
==========================================
  Files         348      348              
  Lines       86073    86093      +20     
==========================================
+ Hits        69142    69152      +10     
- Misses      16931    16941      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jajhall jajhall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for spotting and fixing this

@jajhall
jajhall merged commit 0e9d40e into ERGO-Code:latest Jan 28, 2026
219 of 223 checks passed
@stratakis
stratakis deleted the nowactiveatlower_uninit branch March 20, 2026 05:10
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