[FFmpeg-devel] [PATCH V1 2/6] lavc/aac_adtstoasc: use initialized var for avpriv_mpeg4audio_get_config
James Almer
jamrial at gmail.com
Sat Sep 21 05:17:37 EEST 2019
On 9/20/2019 11:12 PM, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao at tencent.com>
>
> avpriv_mpeg4audio_get_config will use MPEG4AudioConfig.chan_config to get
> the MPEG4AudioConfig.channels, but if we use a uninitialized variable,
> we will get an indeterminate channels, add an explicit initialization
> for this case.
in mpeg4audio.c i'm seeing
c->chan_config = get_bits(gb, 4);
if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
c->channels = ff_mpeg4audio_channels[c->chan_config];
First chan_config is set using bitstream data, then channels is derived
from it. So not sure what you mean by uninitialized variable.
>
> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
> libavcodec/aac_adtstoasc_bsf.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
> index 6541b11..96e80b0 100644
> --- a/libavcodec/aac_adtstoasc_bsf.c
> +++ b/libavcodec/aac_adtstoasc_bsf.c
> @@ -133,7 +133,7 @@ static int aac_adtstoasc_init(AVBSFContext *ctx)
> {
> /* Validate the extradata if the stream is already MPEG-4 AudioSpecificConfig */
> if (ctx->par_in->extradata) {
> - MPEG4AudioConfig mp4ac;
> + MPEG4AudioConfig mp4ac = {0};
> int ret = avpriv_mpeg4audio_get_config(&mp4ac, ctx->par_in->extradata,
> ctx->par_in->extradata_size * 8, 1);
> if (ret < 0) {
>
More information about the ffmpeg-devel
mailing list