Repository navigation
Guard degenerate input in DistanceMatrix::operator==, ClusteringGrid::getClusters, File path helpers - #9497
Conversation
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-12 13:37:08.508136702 +0000
+++ AUTHORS.new 2026-06-12 13:37:13.587384792 +0000
@@ -22,8 +22,8 @@
- Chirag Dave
- Chris Bauer
- Chris Bielow
- - Christie Mathews
- Christian Ehrlich
+ - Christie Mathews
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThis PR introduces three independent defensive programming improvements: DistanceMatrix equality comparison safely handles size mismatches, ClusteringGrid::getClusters safely handles missing cells, and File path utilities defensively guard against null environment variables. ChangesSafety and Robustness Fixes
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tests/class_tests/openms/source/DistanceMatrix_test.cpp`:
- Around line 219-223: The new test block uses tab characters for indentation;
replace those tabs with 2-space indentation in the block containing
DistanceMatrix<double> dm_small(3, 1.0); and the two TEST_EQUAL assertions
(dm==dm_small and dm_small==dm) so the changed C++ code follows the project's
no-tabs / 2-space indentation rule.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fbeab895-c7d2-489c-9efc-7f3d1531e781
📒 Files selected for processing (6)
src/openms/include/OpenMS/DATASTRUCTURES/DistanceMatrix.hsrc/openms/include/OpenMS/SYSTEM/File.hsrc/openms/source/ML/CLUSTERING/ClusteringGrid.cppsrc/openms/source/SYSTEM/File.cppsrc/tests/class_tests/openms/source/ClusteringGrid_test.cppsrc/tests/class_tests/openms/source/DistanceMatrix_test.cpp
…:getClusters, File path helpers POLS audit (OpenMS#9488). Each only changes a previously-undefined path; valid input unchanged. - DistanceMatrix::operator==: guarded only by OPENMS_PRECONDITION (no-op in release), then iterated rhs's dimensions while indexing *this -> heap OOB read for a smaller left-hand matrix (or a debug throw). Now returns false for differently-sized matrices. - ClusteringGrid::getClusters: did cells_.find(idx)->second with no end() check -> dereferenced map::end() (UB) for a never-populated cell. Now returns an empty list. - File::getPathLocations / executableExtensions_: the default argument constructed a std::string directly from std::getenv("PATH"/"PATHEXT"), which is undefined behavior when the variable is unset (getenv returns nullptr). The default is now "" and the function reads the environment variable internally with a null guard. Regression tests added for DistanceMatrix (different sizes compare unequal) and ClusteringGrid (unknown cell -> empty); all three suites pass. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ART_SECTION default arg Co-Authored-By: Claude Opus 4.8 <[email protected]>
97d9890 to
1a29e6c
Compare
|
Adversarial review result: I did not find a blocking issue in this change. The No whitespace errors or source/test comments with tracker-style issue references stood out in this diff. I did not build or run the tests locally. |
Add entries for all substantive non-test PRs merged since the last changelog update: - #9623 ThermoRawFile full mzML metadata extraction + polarity fix - #9602 New FileInfo library class usable from C++ and pyOpenMS - #9521 IMAGING multi-region support (add missing PR reference) - #9620 Deisotoper::isToleranceSupported + ProSE/SSE crash fix on low-res data - #9610 DistanceMatrix::setValue cached-minimum guard fix - #9497 DistanceMatrix::operator==, ClusteringGrid, File path guard fixes - #9583 LogStreamBuf thread-safety fix - #9514 CI Windows migration to Visual Studio 2026 Claude-Session: https://claude.ai/code/session_01YLg6pWyjyTxpWAU6mgrDzC Co-authored-by: Claude <[email protected]>
POLS audit fixes (#9488). Each only changes a previously-undefined path; valid input is unchanged, no reference files touched.
DistanceMatrix::operator==— guarded only byOPENMS_PRECONDITION(a no-op in release), then iteratedrhs's dimensions while indexing*this→ heap OOB read for a smaller left-hand matrix (debug: a throw). Now returnsfalsefor differently-sized matrices.ClusteringGrid::getClusters—cells_.find(idx)->secondwith noend()check → dereferencedmap::end()(UB) for a never-populated cell. Now returns an empty list.File::getPathLocations/executableExtensions_— the default argument constructed astd::stringdirectly fromstd::getenv("PATH"/"PATHEXT"), which is UB when the variable is unset (getenvreturnsnullptr). The default is now""and the function reads the env var internally with a null guard.Regression tests added (different-size matrices compare unequal; unknown grid cell → empty); all three suites pass locally.
Part of #9488. ABI-safe.
🤖 Generated with Claude Code
Summary by CodeRabbit