CRAS: Fix cras_config_global_remix usage
1. Change CRAS_MAX_REMIX_CHANNELS to 8
2. coefficient stores a matrix of values and
we limit num_channels by CRAS_MAX_REMIX_CHANNELS in rclient.
Therefore, the structure should hold a buffer with size
CRAS_MAX_REMIX_CHANNELS^2.
3. In cras_control_rclient, we should
- create a local coefficient array with
`len = m->num_channels * m->num_channels`
- copy m->num_channels * m->num_channels of data to the array
since the coefficient array is a matrix. Or
audio_thread_config_global_remix will access invalid heap memory.
This bug was introduced by 3fdcd82ac7dc648ea93cca5072e59cd5c33ebeaa.
4. Add unit test to simulate audio_thread_config_global_remix memory
accessing. The test can fail old behavior in (3).
BUG=chromium:1097308
TEST=`FEATURES=test USE=asam emerge-${BOARD} adhd`
TEST=cras_rclient_message_fuzzer in ClusterFuzz
Change-Id: I7a5e5b6c552c4b3d3cb18c08d6f8e84610d2aa1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2188072
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
3 files changed