Skip to content

amy_default_config: zero the config, and NULL the cv output hook - #1188

Merged
dpwe merged 1 commit into
mainfrom
default-config-zero
Sep 25, 2026
Merged

dpwe merged 1 commit into
mainfrom
default-config-zero

Conversation

@bwhitman

Copy link
Copy Markdown
Collaborator

amy_external_cv_output_hook (added with note outputs, #1172) is never initialised in amy_default_config(), so on a host that doesn't install one it holds stack garbage. The first note sent to a synth with note_output=CV_GATE then calls through it in cv_output() — a jump to a random address (seen as SIGBUS on macOS, stack c_amy_send_wire → amy_play_message → amy_event_to_deltas_queue → patches_event_has_voices → note_output_handle_event).

This sets it to NULL like the other hooks, and memsets the struct first so any field added later and missed in the list defaults to 0/NULL instead of garbage.

Verified on a macOS miniaudio host: a synth configured with note_output='1,0,2' and sent notes no longer crashes.

🤖 Generated with Claude Code

amy_external_cv_output_hook (added with note outputs) was never set in
amy_default_config(), so on any host that did not install one it held
whatever was on the caller's stack. The first note to a synth with
note_output=CV_GATE then called through it: a jump to a random address
(SIGBUS on macOS, from patches_event_has_voices ->
note_output_handle_event -> cv_output).

Set it to NULL like its neighbours, and memset the struct first so a
field added later and missed in the list is 0 rather than garbage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/api.c
// first time AMY calls it (amy_external_cv_output_hook was exactly
// that: never initialised here, so a note output crashed any host
// that did not set it).
memset(&c, 0, sizeof(c));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I kinda hate this kind of belt-and-braces because it leads to inconsistent redundancy. But whatever

@dpwe
dpwe merged commit 8d8bb68 into main Sep 25, 2026
12 checks passed
@bwhitman

Copy link
Copy Markdown
Collaborator Author

⛓️ tulipcc integration PR opened

This merge was pinned into tulipcc for full-system CI: shorepine/tulipcc#1376

Test it there and merge that PR to move tulipcc onto this AMY.

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