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

Michael Niedermayer michaelni
Wed Sep 6 15:53:02 CEST 2006


Hi

On Wed, Sep 06, 2006 at 03:42:56PM +0200, Guillaume Poirier wrote:
> Hi,
> 
> Panagiotis Issaris wrote:
> > Hi,
> > 
> > Furthermore, these memory allocations together with several other spread through the
> > project seem not to be checked for failure. Is that on purpose or are they 
> > just not yet implemented?
> 
> 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 ...


[...]
-- 
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