Re: [gtk-vnc-devel] [patch] - Use GLib memory functions



On Thu, Apr 10, 2008 at 11:17:18PM -0500, Anthony Liguori wrote:
> Jonh Wendell wrote:
> > Hi, folks.
> >
> > As discussed previously, here is a patch to use GLib functions always as
> > possible.
> >
> > May I commit?
> >   
> 
> I'd kind of prefer replacing g_try_malloc with g_malloc.  We can't 
> gracefully handle out of memory conditions so we might as well let glib 
> kill the application.

I'm not so sure about that. The size of the data we're mallocing is often
being generated based on data from the remote server messages. eg, mallocing
a block based on the size of the framebuffer update. The server could thus
send bogus size and trick us into mallocing data for a 65536x65536 update 
and cause malloc to fail and the app to crash. With the current scheme of
checking malloc we'd merely terminate the VNC connection and not crash
which i think is nicer behaviour.

Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]