From 1dd531ff0333c54553560fe306260d9d81a931c7 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 11 Aug 2021 10:56:14 -0400 Subject: codec_thread.c don't overrun audio_formats[] array Change-Id: I58941cea061f41478d7677beb9ff42e28b2455a6 --- apps/codec_thread.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'apps/codec_thread.c') 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 : ""); -- cgit v1.2.3