[FFmpeg-devel] [PATCH] lavfi/abuffer: init the data planes with NULL pointers.

Clément Bœsch ubitux at gmail.com
Wed Feb 15 15:11:50 CET 2012


From: Clément Bœsch <clement.boesch at smartjog.com>

Samples buffer ref is allocated and loaded with the uninitialized data
pointers:
     av_asrc_buffer_add_buffer()
  -> av_asrc_buffer_add_samples()
  -> avfilter_get_audio_buffer_ref_from_arrays(data, ...)

...which leads to a crash with at least lavfi/ashowinfo in case of !NULL
(see the for loop while samplesref->data[plane]).
---
Expected this with -af showinfo while working on -af option in ffmpeg (which
make use of the abuffer filter to feed filterchain with samples).
---
 libavfilter/asrc_abuffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavfilter/asrc_abuffer.c b/libavfilter/asrc_abuffer.c
index ad71e12..5eca785 100644
--- a/libavfilter/asrc_abuffer.c
+++ b/libavfilter/asrc_abuffer.c
@@ -234,7 +234,7 @@ int av_asrc_buffer_add_buffer(AVFilterContext *ctx,
                               int sample_fmt, int64_t channel_layout, int planar,
                               int64_t pts, int av_unused flags)
 {
-    uint8_t *data[8];
+    uint8_t *data[8] = {0};
     int linesize[8];
     int nb_channels = av_get_channel_layout_nb_channels(channel_layout),
         nb_samples  = buf_size / nb_channels / av_get_bytes_per_sample(sample_fmt);
-- 
1.7.9



More information about the ffmpeg-devel mailing list