[PATCH 1/6] gnome-desktop: handle edid data that can't be parsed



decode_edid() may return NULL if the data can't be parsed,
but the code assumed that it would not, which led to
crashes.

This fixes that assumption, and also adds a check elsewhere
which could be triggered as a result of this

--- gnome-desktop-2.22.1/libgnome-desktop/monitor-db.c  2008-04-14
19:59:22.000000000 +0100
+++ gnome-desktop-2.22.1.new/libgnome-desktop/monitor-db.c
2008-04-14 19:59:22.000000000 +0100
@@ -382,9 +382,10 @@
            MonitorInfo *info = NULL;
 
            if (edid_data)
-           {
                info = decode_edid (edid_data);
                
+       if (info) {
+       
                memcpy (output->vendor, info->manufacturer_code,
                        sizeof (output->vendor));
                
@@ -610,6 +611,8 @@
 {
     int i;
 
+    g_return_val_if_fail(config != NULL, NULL);
+
     for (i = 0; config->outputs[i] != NULL; ++i)
     {
        Output *output = config->outputs[i];





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