Skip to content

Phase 4: conversion/C-API tests + low-severity finding fixes - #3

Merged
tap merged 1 commit into
masterfrom
claude/rtaudio-phase4-cleanup-tests
Jun 23, 2026
Merged

Phase 4: conversion/C-API tests + low-severity finding fixes#3
tap merged 1 commit into
masterfrom
claude/rtaudio-phase4-cleanup-tests

Conversation

@tap

@tap tap commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Overview

Phase 4 of the audit-and-hardening work (follows the merged #1/#2). Two themes: more test coverage and a few low-severity finding fixes. Tracked in AUDIT.md.

All 16 CI jobs pass. The new tests run on every platform with no audio hardware and pass under ASan/UBSan; the backend fixes are compile-verified across the matrix (Linux/macOS/MinGW) but, lacking the target hardware, were not runtime-tested.

More test coverage

  • tests/convtest.cpp — reaches the protected convertBuffer/byteSwapBuffer routines via a minimal RtApi subclass (no library change). Covers byte-swapping (16/32/64-bit), the previously-UB signed left-shift conversions with known negative-value results, format round-trips, and channel mapping. This is the runtime validation of the Audit & hardening: fix memory-safety/UB defects, add tests, sanitizers & static analysis to CI #1 convertBuffer UB fix that was previously only review-verified — 66 checks, green under -fsanitize=address,undefined.
  • tests/unittest.cpp — added a C-API instance lifecycle smoke test (create / query / destroy, no stream). Both wired into CMake, autotools, and meson.

Low-severity finding fixes (backend, CI-compile-verified)

  • WASAPI ring buffer — the wrap-size computation was done in unsigned then narrowed to int (implementation-defined); now computed in signed 64-bit and clamped.
  • OSSSNDCTL_DSP_SETTRIGGER ioctl results are checked, and the duplex triggered flag is only set when both succeed.
  • DirectSound / ASIO — a failed CreateEvent for the drain/condition event now errors out of probeDeviceOpen instead of leaving a NULL handle that silently breaks drain signaling.

AUDIT.md updated (Phase 4 section; also de-dups a stray section header).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt


Generated by Claude Code

Tests (run on every platform; no audio hardware required):

* tests/convtest.cpp: reaches the protected convertBuffer/byteSwapBuffer
  routines via a minimal RtApi subclass (no library change). Covers
  byte-swapping (16/32/64-bit), the previously-UB signed left-shift
  conversions with known negative-value results, format round-trips, and
  channel mapping. This is the runtime validation of the Phase 1
  convertBuffer UB fix that was previously only review-verified; it passes
  under -fsanitize=address,undefined. Wired into CMake/autotools/meson.

* tests/unittest.cpp: added a C-API instance lifecycle smoke test
  (create/query/destroy without opening a stream).

Low-severity finding fixes (backend code, compile-verified by CI):

* WASAPI ring buffer: the wrap-size computation was done in unsigned and
  narrowed to int (implementation-defined); now computed in signed
  64-bit and clamped.

* OSS: SNDCTL_DSP_SETTRIGGER ioctl results are checked, and the duplex
  trigger flag is only set when both ioctls succeed.

* DirectSound / ASIO: a failed CreateEvent for the drain/condition event
  now errors out of probeDeviceOpen instead of leaving a NULL handle that
  silently breaks drain signaling.

AUDIT.md updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt
@tap
tap merged commit 13d80c2 into master Jun 23, 2026
32 checks 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.

2 participants