diff options
author | Laurent Aimar <fenrir@videolan.org> | 2011-10-02 00:48:11 +0000 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2012-03-18 17:50:40 +0100 |
commit | 5ab326d7db3fd3feba570188b49dd4cd69105e9c (patch) | |
tree | 32873761f0d9bb5bab6c2b0268ebec6bfc19aa38 | |
parent | 39fd8d0083f416812bce028126ece47b418a203b (diff) | |
download | ffmpeg-5ab326d7db3fd3feba570188b49dd4cd69105e9c.tar.gz |
4xmdemux: prevent use of uninitialized memory
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
(cherry picked from commit 79964745b3ed5a700f4f0dda56c7360497328c88)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r-- | libavformat/4xm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 93c90e8cbc..5477ed0938 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -172,13 +172,15 @@ static int fourxm_read_header(AVFormatContext *s, goto fail; } if (current_track + 1 > fourxm->track_count) { - fourxm->track_count = current_track + 1; fourxm->tracks = av_realloc(fourxm->tracks, - fourxm->track_count * sizeof(AudioTrack)); + (current_track + 1) * sizeof(AudioTrack)); if (!fourxm->tracks) { - ret= AVERROR(ENOMEM); + ret = AVERROR(ENOMEM); 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].channels = AV_RL32(&header[i + 36]); |