Phase 4: conversion/C-API tests + low-severity finding fixes - #3
Merged
Conversation
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
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.
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 protectedconvertBuffer/byteSwapBufferroutines via a minimalRtApisubclass (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 #1convertBufferUB 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)
int(implementation-defined); now computed in signed 64-bit and clamped.SNDCTL_DSP_SETTRIGGERioctl results are checked, and the duplextriggeredflag is only set when both succeed.CreateEventfor the drain/condition event now errors out ofprobeDeviceOpeninstead of leaving a NULL handle that silently breaks drain signaling.AUDIT.mdupdated (Phase 4 section; also de-dups a stray section header).🤖 Generated with Claude Code
https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt
Generated by Claude Code