[vlc-devel] [VLC] #2366: realloc is generally used incorrectly

Rémi Denis-Courmont remi at remlab.net
Mon May 25 12:24:05 CEST 2009

On Mon, 25 May 2009 11:10:49 +0200 (CEST), jpd at m2x.nl wrote:
> On Sun, May 24, 2009 at 09:17:42AM -0000, VLC wrote:
>>  This is not simple.
>>  The request is essential for the web plugins (so I CC: jp* :) )
> The only thing that uses realloc() in the plugin (and it really should
> in the first place) is the bit that Does Stuff to argument parsing, which
> has changed from necessairy to superfluous with moving away from
> libvlc_playlist_*.
> Changing is probably less hard than it looks if you look at the input and
> output requirements, ignoring the middle. Some architectural changes will
> be needed, though.
> I can't look at it now so patches are welcome.

Better _not_ look at it than put some partial obfuscating fixes like the
other Jean-Paul just did, IMHO.

In any case, even if the ~300 buggy of the ~400 realloc() sites in the tree
were fixed, we would still have OOM problems. And even if OOM problems were
all fixed, VLC would still crash the browsers about just as often. Besides,
there are underlying libraries that are not OOM-safe (e.g. Qt4, though not
needed by the browser, but there has to be other ones).

Realistically, the only pragmatic way to not crash the browser is to run
the VLC plugin in a separate process.
I am planning to implement XEmbed support as soon as Laurent's reworked
video output is available, which could help the Mozilla/X11 plugin (I am
NOT planning to do the projects/mozilla/ part of the work though).

Rémi Denis-Courmont

More information about the vlc-devel mailing list