backend/dummy: Warn about missing dummy mode specs

When malformed modes are provided and no valid mode spec is found, mutter
will eventually try to access the last element of an empty list. Warn about
this and exit properly.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1481
This commit is contained in:
Christian Rauch 2020-10-21 23:21:41 +01:00
parent a51ad8f932
commit 4862e4cb39

View File

@ -34,6 +34,7 @@
#include "backends/meta-monitor.h" #include "backends/meta-monitor.h"
#include "backends/meta-monitor-config-manager.h" #include "backends/meta-monitor-config-manager.h"
#include "backends/meta-output.h" #include "backends/meta-output.h"
#include "meta/main.h"
#include "meta/util.h" #include "meta/util.h"
#define MAX_MONITORS 5 #define MAX_MONITORS 5
@ -190,6 +191,12 @@ append_monitor (MetaMonitorManager *manager,
} }
} }
if (!mode_specs)
{
g_warning ("Cannot create dummy output: No valid mode specs.");
meta_exit (META_EXIT_ERROR);
}
for (l = mode_specs; l; l = l->next) for (l = mode_specs; l; l = l->next)
{ {
CrtcModeSpec *spec = l->data; CrtcModeSpec *spec = l->data;