Commit 79964745 authored by Laurent Aimar's avatar Laurent Aimar Committed by Janne Grunau

4xmdemux: prevent use of uninitialized memory

Signed-off-by: 's avatarJanne Grunau <janne-libav@jannau.net>
parent 8d518a9c
...@@ -173,13 +173,15 @@ static int fourxm_read_header(AVFormatContext *s, ...@@ -173,13 +173,15 @@ static int fourxm_read_header(AVFormatContext *s,
goto fail; goto fail;
} }
if (current_track + 1 > fourxm->track_count) { if (current_track + 1 > fourxm->track_count) {
fourxm->track_count = current_track + 1;
fourxm->tracks = av_realloc(fourxm->tracks, fourxm->tracks = av_realloc(fourxm->tracks,
fourxm->track_count * sizeof(AudioTrack)); (current_track + 1) * sizeof(AudioTrack));
if (!fourxm->tracks) { if (!fourxm->tracks) {
ret= AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
memset(&fourxm->tracks[fourxm->track_count], 0,
sizeof(AudioTrack) * (current_track + 1 - fourxm->track_count));
fourxm->track_count = current_track + 1;
} }
fourxm->tracks[current_track].adpcm = AV_RL32(&header[i + 12]); fourxm->tracks[current_track].adpcm = AV_RL32(&header[i + 12]);
fourxm->tracks[current_track].channels = AV_RL32(&header[i + 36]); fourxm->tracks[current_track].channels = AV_RL32(&header[i + 36]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment