Skip to content

fix: prevent segfault in copyToChannel on Android - #44

Merged
tai2 merged 1 commit into
mainfrom
fix-segfault-on-android
Apr 17, 2026
Merged

fix: prevent segfault in copyToChannel on Android#44
tai2 merged 1 commit into
mainfrom
fix-segfault-on-android

Conversation

@tai2

@tai2 tai2 commented Apr 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix SIGSEGV crash in AudioBufferHostObject::copyToChannel on Android by computing buffer size from actual chunk data (not bufferedFramesRef) and merging all chunks into a single Float32Array before a single copyToChannel call — eliminates the offset-tracking loop where a size mismatch could cause an out-of-bounds native memcpy
  • Clamp voiceStartSecs to non-negative to prevent invalid playback offsets if frame accounting drifts
  • Enable Sentry enableTombstone for richer Android NDK crash reports with thread info and better stack traces

Test plan

  • pnpm typecheck passes
  • pnpm lint passes (no new warnings)
  • pnpm test:ci passes (114 tests)
  • Manual test on Android: record → playback cycle 3+ times without crash
  • Verify Sentry now collects tombstone data on Android crashes

🤖 Generated with Claude Code

…efore copy

Compute buffer size from actual chunk data instead of trusting bufferedFramesRef,
merge all chunks into a single Float32Array, and make one copyToChannel call.
This eliminates the offset-tracking loop where a mismatch could cause an
out-of-bounds native memcpy. Also enables Sentry tombstone collection for
richer Android NDK crash reports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tai2
tai2 merged commit 0a5122b into main Apr 17, 2026
1 check passed
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