Initialize nowactiveatlower in ratiotest_textbook - #2778
Merged
Conversation
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
Contributor
Author
|
Technically this issue won't manifest, as the only caller I found was here: HiGHS/highs/qpsolver/quass.cpp Line 478 in 6ab51a3 Where 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
jajhall
approved these changes
Jan 28, 2026
jajhall
left a comment
Member
There was a problem hiding this comment.
Thanks for spotting and fixing this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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