[Ffmpeg-devel] [PATCH] Replace av_malloc+memset with av_mallocz

Rich Felker dalias
Thu Sep 7 00:44:55 CEST 2006


On Wed, Sep 06, 2006 at 08:58:48PM +0200, Michael Niedermayer wrote:
> Hi
> 
> On Wed, Sep 06, 2006 at 04:02:04PM +0200, Panagiotis Issaris wrote:
> > Hi,
> > 
> > Op woensdag 6 september 2006 15:53, schreef Michael Niedermayer:
> > >[...] 
> > > > AFAIK, it's because memory allocation fails, if a disaster occurs
> > > > (badly OOM for instance, ...) and means that my may be better off
> > > > killing the prgm as the OS will probably kill some prgm to free some
> > > > memory. So by not checking if allocation succeeds, you just guarantee
> > > > that in case of OOM, you will be killed by a segfault rather than
> > > > being killed by the kernel OOM killer.
> > > 
> > > this isnt the whole story ...
> > > theres the issue with DOS attacks too (= files designed to cause OOM)
> > > so IMHO checking the sizes before alloc() if the size is specified in 
> > > some input file is a good idea ...
> > 
> > But how would you do that? Check for the allocation of "really big" 
> > blocks of memory? It doesn't seem that easy to me to define such a
> > maximum.
> 
> well, leave the limit to the user

It would be nice if, when initializing a context, the caller could
specify the max memory usage by the context.. Maybe this is too
painful to support though.

Rich





More information about the ffmpeg-devel mailing list