Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9e9f33b authored by Jasmine Cha's avatar Jasmine Cha
Browse files

ma_listener: correct bounds of array



crashed by array index out of bounds.

Bug: 79468907
Bug: 79472606
Bug: 79495729
Test: manual audio test rington/music/alarm/notification

Change-Id: I327ef3b77c7c65064b67dfdc3404cf59d5d84203
Signed-off-by: default avatarJasmine Cha <chajasmine@google.com>
parent acbca59e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ struct ma_state {

static const audio_stream_type_t MIN_STREAM_TYPES = AUDIO_STREAM_VOICE_CALL;
static const audio_stream_type_t MAX_STREAM_TYPES = AUDIO_STREAM_NOTIFICATION;
static struct ma_state g_cur_state[MAX_STREAM_TYPES];
static struct ma_state g_cur_state[MAX_STREAM_TYPES + 1];

struct ma_listener_context_s {
    const struct effect_interface_s *itfe;
@@ -211,6 +211,8 @@ static void check_and_set_ma_parameter(uint32_t stream_type)
    else if (max_vol > 1.0) max_vol = 1.0;

    if (send_ma_parameter != NULL &&
        stream_type >= MIN_STREAM_TYPES &&
        stream_type <= MAX_STREAM_TYPES &&
        (g_cur_state[stream_type].vol != max_vol ||
         g_cur_state[stream_type].active != active)) {