diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-08-11 10:56:14 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-08-11 10:56:14 -0400 |
commit | 1dd531ff0333c54553560fe306260d9d81a931c7 (patch) | |
tree | 86d3dd1838c0eec7d08226f091ca1b0f71a32529 | |
parent | e3e72d6dba080c31b717ee3b53a3fde181123766 (diff) |
codec_thread.c don't overrun audio_formats[] array
Change-Id: I58941cea061f41478d7677beb9ff42e28b2455a6
-rw-r--r-- | apps/codec_thread.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c index 807c0b6e8e..999b844349 100644 --- a/apps/codec_thread.c +++ b/apps/codec_thread.c @@ -183,14 +183,16 @@ const char * get_codec_filename(int cod_spec) /* Can choose decoder or encoder if one available */ int type = cod_spec & CODEC_TYPE_MASK; int afmt = cod_spec & CODEC_AFMT_MASK; - + int tmp_fmt = afmt; if ((unsigned)afmt >= AFMT_NUM_CODECS) + { type = AFMT_UNKNOWN | (type & CODEC_TYPE_MASK); - + tmp_fmt = AFMT_UNKNOWN; + } fname = (type == CODEC_TYPE_ENCODER) ? - audio_formats[afmt].codec_enc_root_fn : - audio_formats[afmt].codec_root_fn; - + audio_formats[tmp_fmt].codec_enc_root_fn : + audio_formats[tmp_fmt].codec_root_fn; + logf("%s: %d - %s", (type == CODEC_TYPE_ENCODER) ? "Encoder" : "Decoder", afmt, fname ? fname : "<unknown>"); |