Blame SOURCES/0001-screenshot-Extend-ScreenshotArea-parameter-validatio.patch

b97e22
From 3430f0cb832a489ce8dee1e9294ca7a724f367af Mon Sep 17 00:00:00 2001
b97e22
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
b97e22
Date: Mon, 4 Nov 2013 11:14:44 +0100
b97e22
Subject: [PATCH 1/3] screenshot: Extend ScreenshotArea parameter validation
b97e22
b97e22
We currently only ensure that width and height are positive, so it
b97e22
is still possible to pass in values that don't make any sense at all
b97e22
(which may even result in a crash when exceeding limits imposed by
b97e22
X11).
b97e22
There is nothing to screenshot outside the actual screen area, so
b97e22
restrict the parameters to that.
b97e22
b97e22
https://bugzilla.gnome.org/show_bug.cgi?id=699752
b97e22
---
b97e22
 js/ui/screenshot.js | 4 +++-
b97e22
 1 file changed, 3 insertions(+), 1 deletion(-)
b97e22
b97e22
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
b97e22
index 2219a89..3c5c831 100644
b97e22
--- a/js/ui/screenshot.js
b97e22
+++ b/js/ui/screenshot.js
b97e22
@@ -76,7 +76,9 @@ const ScreenshotService = new Lang.Class({
b97e22
 
b97e22
     ScreenshotAreaAsync : function (params, invocation) {
b97e22
         let [x, y, width, height, flash, filename, callback] = params;
b97e22
-        if (height <= 0 || width <= 0) {
b97e22
+        if (x < 0 || y < 0 ||
b97e22
+            width <= 0 || height <= 0 ||
b97e22
+            x + width > global.screen_width || y + height > global.screen_height) {
b97e22
             invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
b97e22
                         "Invalid params");
b97e22
             return;
b97e22
-- 
b97e22
1.8.4.2
b97e22