aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/4xm.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-10-02 00:48:11 +0000
committerJanne Grunau <janne-libav@jannau.net>2011-10-10 21:37:35 +0200
commit79964745b3ed5a700f4f0dda56c7360497328c88 (patch)
treeb3ba9351ef6a9f3e8116767d6e52a77fdca2c9c9 /libavformat/4xm.c
parent8d518a9c4fe92e2497565f1765da7f913be8b1e7 (diff)
downloadffmpeg-79964745b3ed5a700f4f0dda56c7360497328c88.tar.gz
4xmdemux: prevent use of uninitialized memory
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavformat/4xm.c')
-rw-r--r--libavformat/4xm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 6224134948..1557c5b5a4 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -173,13 +173,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]);