On Thu, Oct 06, 2011 at 10:35:30PM +0200, Janne Grunau wrote: > On Sat, Sep 17, 2011 at 04:56:29PM +0200, [email protected] wrote: > > From: Laurent Aimar <[email protected]> > > > > --- > > libavformat/segafilm.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c > > index ff773ea..4bbacc5 100644 > > --- a/libavformat/segafilm.c > > +++ b/libavformat/segafilm.c > > @@ -255,8 +255,8 @@ static int film_read_packet(AVFormatContext *s, > > /* make sure the interleave buffer is large enough */ > > if (sample->sample_size > film->stereo_buffer_size) { > > av_free(film->stereo_buffer); > > - film->stereo_buffer = av_malloc(film->stereo_buffer_size); > > film->stereo_buffer_size = sample->sample_size; > > + film->stereo_buffer = av_malloc(film->stereo_buffer_size); > > if (!film->stereo_buffer) { > > film->stereo_buffer_size = 0; > > return AVERROR(ENOMEM); > > err, this doesn't apply and seems to just fix your own error then adding > the null check. Yes, the correct patch is attached.
-- fenrir
commit 7cbe02575868e7d25acf3d319ece664702700f0a Author: Laurent Aimar <[email protected]> Date: Mon Sep 12 20:58:35 2011 +0200 segafilm: Check for memory allocation failures in segafilm demuxer. Signed-off-by: Michael Niedermayer <[email protected]> diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 7a84daf..00a248e 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -176,6 +176,8 @@ static int film_read_header(AVFormatContext *s, if(film->sample_count >= UINT_MAX / sizeof(film_sample)) return -1; film->sample_table = av_malloc(film->sample_count * sizeof(film_sample)); + if (!film->sample_table) + return AVERROR(ENOMEM); for(i=0; i<s->nb_streams; i++) av_set_pts_info(s->streams[i], 33, 1, film->base_clock); @@ -252,6 +254,10 @@ static int film_read_packet(AVFormatContext *s, av_free(film->stereo_buffer); film->stereo_buffer_size = sample->sample_size; film->stereo_buffer = av_malloc(film->stereo_buffer_size); + if (!film->stereo_buffer) { + film->stereo_buffer_size = 0; + return AVERROR(ENOMEM); + } } pkt->pos= avio_tell(pb);
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
