[MPlayer-dev-eng] possible bug in demux_mov.c

D Richard Felker III dalias at aerifal.cx
Mon Apr 21 22:52:01 CEST 2003


On Mon, Apr 21, 2003 at 09:49:11PM +0200, Arpi wrote:
> Hi,
> 
> > > > In demux_mov.c at line 498 there is a unchecked malloc.
> > > > This could probably leed to a segfault.
> > > 
> > > there are thousands of unchecked mallocs in mplayer source
> > > we don't expect to fail allocating few kBs of memory...
> > 
> > I agree, checking malloc return is nonsense. If there's not enough
> > mem, crashing is just as good as printing a fatal error followed by
> > 'clean' exit...
> 
> also note, that it doesn't even happen on VM systems, as there are 2GB
> VM, whiel you have actually a lot less plhisical memory, so your app
> will be killed by kernel's OOM before your app gets any error of malloc()
> (you can even malloc() 2GB, it will be allocated really when you start use
> (address) it, malloc won't fail even if you have only 8MB ram)

This is true, but it depends on the system. There's either some patch
or compiletime option in Linux now to disable 'overcommit' and make
the allocation fail immediately in [s]brk().

Rich



More information about the MPlayer-dev-eng mailing list