Re: [gtk-vnc-devel] [patch] - Use GLib memory functions
- From: Anthony Liguori <anthony codemonkey ws>
- To: "Daniel P. Berrange" <berrange redhat com>
- Cc: gtk-vnc-devel List <gtk-vnc-devel lists sourceforge net>
- Subject: Re: [gtk-vnc-devel] [patch] - Use GLib memory functions
- Date: Fri, 11 Apr 2008 09:53:09 -0500
Daniel P. Berrange wrote:
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.
malloc() won't fail unless you run out of virtual address space (which
is never going to happen on x86_64). You won't see an error until you
try and fault in the memory.
In the above case, we should try and detect bogus rectangles and bail
accordingly. The nice thing about crashing in g_malloc() is you'll get
a better bug report out of it (since it should trigger apport).
Regards,
Anthony Liguori
Dan.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]