Fix KSChan point-process OOB write of dparam[2] - #3844
Merged
Conversation
KSChan::alloc always nulled prop->dparam[2] for point processes, but that slot exists only when single-channel mode (or later fields) makes ppsize > 2. Plain point KSChan instances allocate only area and pnt, so the write was past the allocated Datum vector. The default ArrayPool freelist order hid the overflow inside the next free slab row; a reversed freelist exposes it under ASAN. nrn_prop_datum_alloc already default-constructs every Datum to null, and dparam[0]/[1] are filled by point.cpp after nrn_alloc. The redundant nulling is removed; single_->alloc still runs when single_ is set and the singleptr slot is null.
|
Contributor
|
✔️ aa65940 -> artifacts URL |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3844 +/- ##
==========================================
+ Coverage 68.33% 68.35% +0.02%
==========================================
Files 700 700
Lines 112198 112196 -2
==========================================
+ Hits 76668 76692 +24
+ Misses 35530 35504 -26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
✔️ aa65940 -> Azure artifacts URL |
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.



Summary
KSChan::allocthat always didprop->dparam[2] = nullptrfor point processes.ppsize > 2. Plain point KSChan instances allocate onlyareaandpnt, so index 2 was past the allocatedDatumvector.ArrayPoolfreelist order hid the overflow inside the next free slab row; a reversed freelist exposes it under ASAN (seesrc/nrniv/kschan.cppis allocator sensitive #3843).nrn_prop_datum_allocalready default-constructs everyDatumto the null handle state, anddparam[0]/[1]are filled bypoint.cppafternrn_alloc. The redundant nulling is removed;single_->allocstill runs whensingle_is set and the singleptr slot is null.Test plan
hoctests::test_kschan_py(with and without ASAN).arraypool.hfromsrc/nrniv/kschan.cppis allocator sensitive #3843 and confirm ASAN no longer fails on that test.ks.single(1), etc.) to confirm singleptr allocation still works.Fixes #3843