[FFmpeg-cvslog] Fix use of uninitialized memory in 4X Technologies demuxer.

Laurent Aimar git at videolan.org
Sun Oct 2 05:59:52 CEST 2011


ffmpeg | branch: release/0.8 | Laurent Aimar <fenrir at videolan.org> | Sun Oct  2 00:38:26 2011 +0200| [2e342df4a266f903084a5f705c7f2932e79067de] | committer: Michael Niedermayer

Fix use of uninitialized memory in 4X Technologies demuxer.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit a1876e0072aa0c69f037e0cafaca1a54bf2e189b)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e342df4a266f903084a5f705c7f2932e79067de
---

 libavformat/4xm.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 0a314dc..e3b696d 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -172,14 +172,16 @@ 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_f(fourxm->tracks,
                                               sizeof(AudioTrack),
-                                              fourxm->track_count);
+                                              current_track + 1);
                 if (!fourxm->tracks) {
                     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]);



More information about the ffmpeg-cvslog mailing list