"xrandr --scale 2x2" segfaults, because the --scale (and --transform)
options do not check for an existing output.

Make sure there is an output specified (like every other options).

This is against git master.
See you,
Eric
>From 27618131fbc0b535f22269feaaf4a187e63a1682 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89ric=20Piel?= <eric.p...@tremplin-utc.net>
Date: Mon, 26 Oct 2009 14:11:02 +0100
Subject: [PATCH 2/2] xrandr: do not segfault when "--scale" or "--transform" have no output
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

"xrandr --scale 2x2" segfaults, because the --scale (and --transform)
options do not check for an existing output.

Make sure there is an output specified (like every other options).

Signed-off-by: Éric Piel <eric.p...@tremplin-utc.net>
---
 xrandr.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index 2d61978..eb23784 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2157,7 +2157,6 @@ main (int argc, char **argv)
 	    if (++i>=argc) usage ();
 	    screen = check_strtol(argv[i]);
 	    if (screen < 0) usage();
-	    action_requested = True;
 	    continue;
 	}
 	if (!strcmp ("-q", argv[i]) || !strcmp ("--query", argv[i])) {
@@ -2368,6 +2367,7 @@ main (int argc, char **argv)
 	if (!strcmp ("--scale", argv[i]))
 	{
 	    double  sx, sy;
+	    if (!output) usage();
 	    if (++i>=argc) usage();
 	    if (sscanf (argv[i], "%lfx%lf", &sx, &sy) != 2)
 		usage ();
@@ -2387,6 +2387,7 @@ main (int argc, char **argv)
 	if (!strcmp ("--transform", argv[i])) {
 	    double  transform[3][3];
 	    int	    k, l;
+	    if (!output) usage();
 	    if (++i>=argc) usage ();
 	    init_transform (&output->transform);
 	    if (strcmp (argv[i], "none") != 0)
-- 
1.6.4.4

_______________________________________________
xorg-devel mailing list
xorg-devel@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to