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

Michael Niedermayer michaelni
Wed Sep 6 20:58:48 CEST 2006


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


> 
> And moreover, would that be enough, wouldn't it be possible to construct 
> a file that makes FFmpeg do many smaller allocations, causing OOM?

depends on the container, with simple containers that might be pretty hard

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

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list