[vlc-devel] commit: Commit the good version of the file. (Jean-Baptiste Kempf )

Rémi Denis-Courmont rdenis at simphalempin.com
Mon May 12 19:43:53 CEST 2008


Le Monday 12 May 2008 20:31:56 Jean-Paul Saman, vous avez écrit :
> Please check malloc return value. Malloc can fail ! You don't want to
> override some other part of VLC's memory.

malloc() can fail. There are two ways it can fail:
1/ program is so memory hungry the OOM killer KILLs it -> TEH END.
2/ malloc() returns NULL.

In the first case, memory can clearly not be overwritten. In the second case, 
memory can be overwritten, if AND ONLY IF, attempting to write at an 
arbitrary offset after beginning of the allocation (as happened with the MP4 
demux). Any attempt to write at *NULL, or within 4kiB after NULL (virtual 
memory page number 0) will _ALWAYS_ cause a segmentation fault. Never will it 
overwrite memory.

So please stop with the malloc()-scaremongering.


Rémi Denis-Courmont

More information about the vlc-devel mailing list