Skip to content

Fix uninitialised index when zeroing masked channels in steer2demixing_ds_process - #309

Open
jaysoma wants to merge 1 commit into
introlab:masterfrom
jaysoma:fix/steer2demixing-ds-zero-loop
Open

jaysoma wants to merge 1 commit into
introlab:masterfrom
jaysoma:fix/steer2demixing-ds-zero-loop

Conversation

@jaysoma

@jaysoma jaysoma commented Oct 30, 2026

Copy link
Copy Markdown

In steer2demixing_ds_process, the else branch for a masked channel uses iSampleBC without assigning it, and has no iBin loop, unlike the mask == 1 branch above it.

This is easy to miss on larger arrays. From the code, the index is only uninitialised if every channel is masked, which a ring of 4 rarely hits but a 2-capsule array can: AddressSanitizer reported an access violation at steer2demixing.c:135, reached through mod_sss_process_dds, and it killed 3 of 27 runs over recorded corpora. When some channel is unmasked, the index is left over from that channel, so one valid weight is zeroed and the masked channel keeps its previous weights, with no crash.

The fix gives the else the same loop as the branch above.

Builds with no warnings on Ubuntu 22.04, gcc 11.4. Runtime-tested in my port of ODAS (Android/Windows, KissFFT in place of FFTW): a run that previously died at 256 s and 298 s now completes all 29,044 hops clean under ASan.

🤖 Generated with Claude Code

…g_ds_process

The else branch for a masked channel uses iSampleBC without assigning it and has
no iBin loop, unlike the branch above it. If no channel has been unmasked yet in
this call the index is uninitialised, which is an arbitrary write. Otherwise it
is left over from the last unmasked channel, so one valid weight is zeroed and
the masked channel's own weights keep their previous values. Loop over the bins
as the mask == 1 branch does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant