[libvirt] [libvirt-glib] Check arguments to public libvirt-gobject methods

Daniel P. Berrange berrange at redhat.com
Wed May 23 09:23:50 UTC 2012


On Tue, May 22, 2012 at 11:12:20AM +0200, Christophe Fergeau wrote:
> Some public methods in libvirt-gobject don't have g_return_if_fail
> checks on their arguments. It happens that GNOME Boxes tries to call
> gvir_connection_find_storage_pool_by_name with a NULL GVirConnection
> causing a crash https://bugzilla.gnome.org/show_bug.cgi?id=676216 While
> GNOME Boxes needs to be fixed not to pass an invalid value to this
> function, it's better if libvirt-object sanity checks the argument it is
> passed by the caller before using them.  In this commit, I've went over
> all libvirt-gobject public functions to add g_return_if_fail checks
> where needed.
> ---
>  libvirt-gobject/libvirt-gobject-connection.c       |  122 +++++++++++++++++---
>  libvirt-gobject/libvirt-gobject-domain-device.c    |    4 +
>  libvirt-gobject/libvirt-gobject-domain-disk.c      |    1 +
>  libvirt-gobject/libvirt-gobject-domain-interface.c |    1 +
>  libvirt-gobject/libvirt-gobject-domain-snapshot.c  |    7 +-
>  libvirt-gobject/libvirt-gobject-domain.c           |   70 +++++++++--
>  libvirt-gobject/libvirt-gobject-interface.c        |   13 ++-
>  libvirt-gobject/libvirt-gobject-manager.c          |   27 +++--
>  libvirt-gobject/libvirt-gobject-network-filter.c   |   14 ++-
>  libvirt-gobject/libvirt-gobject-network.c          |   13 ++-
>  libvirt-gobject/libvirt-gobject-node-device.c      |   14 ++-
>  libvirt-gobject/libvirt-gobject-secret.c           |    6 +-
>  libvirt-gobject/libvirt-gobject-storage-pool.c     |   61 ++++++++--
>  libvirt-gobject/libvirt-gobject-storage-vol.c      |   33 ++++--
>  libvirt-gobject/libvirt-gobject-stream.c           |    6 +
>  15 files changed, 321 insertions(+), 71 deletions(-)

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list