[FFmpeg-devel] [PATCH] ffplay: check av_samples_get_buffer_size() return

Michael Niedermayer michaelni at gmx.at
Sun Apr 21 18:25:36 CEST 2013


On Sun, Apr 21, 2013 at 06:19:19PM +0200, Marton Balint wrote:
> 
> 
> On Sun, 21 Apr 2013, Michael Niedermayer wrote:
> 
> >Fixes CID1005310
> >Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> >---
> >ffplay.c |    4 ++++
> >1 file changed, 4 insertions(+)
> >
> >diff --git a/ffplay.c b/ffplay.c
> >index e2014be..ca0a828 100644
> >--- a/ffplay.c
> >+++ b/ffplay.c
> >@@ -2262,6 +2262,10 @@ static int audio_decode_frame(VideoState *is)
> >                int out_count = (int64_t)wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate + 256;
> >                int out_size  = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, out_count, is->audio_tgt.fmt, 0);
> >                int len2;
> >+                if (out_size < 0) {
> >+                    fprintf(stderr, "av_samples_get_buffer_size() failed\n");
> >+                    break;
> >+                }
> >                if (wanted_nb_samples != is->frame->nb_samples) {
> >                    if (swr_set_compensation(is->swr_ctx, (wanted_nb_samples - is->frame->nb_samples) * is->audio_tgt.freq / is->frame->sample_rate,
> >                                                wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate) < 0) {
> 
> LGTM, thanks.

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130421/69f83514/attachment.asc>


More information about the ffmpeg-devel mailing list