OSDN Git Service

audio_mix: initialize the data pointers to NULL
authorAnton Khirnov <anton@khirnov.net>
Mon, 16 Dec 2013 17:20:41 +0000 (18:20 +0100)
committerAnton Khirnov <anton@khirnov.net>
Fri, 3 Jan 2014 15:42:23 +0000 (16:42 +0100)
This should make it easier to catch problems where some of those
pointers are used uninitialized, since reading from NULL should always
crash, while random numbers from stack can turn out to be valid
pointers, so random memory may be silently overwritten.

libavresample/audio_mix.c

index 073609e..765bc73 100644 (file)
@@ -447,7 +447,7 @@ int ff_audio_mix(AudioMix *am, AudioData *src)
 
     if (am->in_matrix_channels && am->out_matrix_channels) {
         uint8_t **data;
-        uint8_t *data0[AVRESAMPLE_MAX_CHANNELS];
+        uint8_t *data0[AVRESAMPLE_MAX_CHANNELS] = { NULL };
 
         if (am->out_matrix_channels < am->out_channels ||
              am->in_matrix_channels <  am->in_channels) {