ffmpegdec: Make sure we provide 16 byte aligned data to ffmpeg. Fixes #572863

We simply allocate the memory using ffmpeg's av_malloc which provides us
with properly memalign'ed data.
This avoids write-outside-of-bounds when sse/altivec code is being used.
This commit is contained in:
Edward Hervey 2009-03-06 17:37:51 +01:00
parent df6fb6867e
commit 98167578c4

View file

@ -1794,8 +1794,12 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (in_duration),
GST_TIME_ARGS (ffmpegdec->next_ts));
/* outgoing buffer */
*outbuf = gst_buffer_new_and_alloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);
/* outgoing buffer. We use av_malloc() to have properly aligned memory. */
*outbuf = gst_buffer_new ();
GST_BUFFER_DATA (*outbuf) = GST_BUFFER_MALLOCDATA (*outbuf) =
av_malloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);
GST_BUFFER_SIZE (*outbuf) = AVCODEC_MAX_AUDIO_FRAME_SIZE;
GST_BUFFER_FREE_FUNC (*outbuf) = av_free;
len = avcodec_decode_audio2 (ffmpegdec->context,
(int16_t *) GST_BUFFER_DATA (*outbuf), &have_data, data, size);