[PATCH xrandr v5 6/6] xrandr: gamma and scaling factors must be positive

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Tue Feb 27 11:20:22 UTC 2018


Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
---
 xrandr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xrandr.c b/xrandr.c
index f6c425f..7f1e867 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2979,6 +2979,9 @@ main (int argc, char **argv)
 		    argerr ("%s: invalid argument '%s'\n", argv[i-1], argv[i]);
 		config_output->gamma.green = config_output->gamma.blue = config_output->gamma.red;
 	    }
+	    if (config_output->gamma.red <= 0.0 || config_output->gamma.green <= 0.0 ||
+		    config_output->gamma.blue <= 0.0)
+		    argerr ("gamma correction factors must be positive\n");
 	    config_output->changes |= changes_gamma;
 	    setit_1_2 = True;
 	    continue;
@@ -3030,6 +3033,8 @@ main (int argc, char **argv)
 		    argerr ("failed to parse '%s' as a scaling factor\n", argv[i]);
 		sy = sx;
 	    }
+	    if (sx <= 0.0 || sy <= 0.0)
+		    argerr ("scaling factors must be positive\n");
 	    init_transform (&config_output->transform);
 	    config_output->transform.transform.matrix[0][0] = XDoubleToFixed (sx);
 	    config_output->transform.transform.matrix[1][1] = XDoubleToFixed (sy);
-- 
2.14.1.439.g647b9b4702



More information about the xorg-devel mailing list