Skip to content

Commit

Permalink
#2714 if the window has invalid dimensions, don't even attempt to han…
Browse files Browse the repository at this point in the history
…dle damage events

git-svn-id: https://xpra.org/svn/Xpra/trunk@26105 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 13, 2020
1 parent 657e7c1 commit 310b98c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
5 changes: 5 additions & 0 deletions src/xpra/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@

CLOBBER_UPGRADE = 0x1
CLOBBER_USE_DISPLAY = 0x2

#if you want to use a virtual screen bigger than 32767x32767
#you will need to change those values, but some broken toolkits
#will then misbehave (they use signed shorts instead of signed ints..)
MAX_WINDOW_SIZE = 2**15-1
6 changes: 6 additions & 0 deletions src/xpra/server/window/window_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from xpra.os_util import memoryview_to_bytes, strtobytes, bytestostr, monotonic_time
from xpra.util import envint, envbool, csv, typedict, first_time
from xpra.common import MAX_WINDOW_SIZE
from xpra.server.window.windowicon_source import WindowIconSource
from xpra.server.window.content_guesser import guess_content_type, get_content_type_properties
from xpra.server.window.window_stats import WindowPerformanceStatistics
Expand Down Expand Up @@ -1276,6 +1277,11 @@ def damage(self, x, y, w, h, options=None):
if ww==0 or wh==0:
damagelog("damage%s window size %ix%i ignored", (x, y, w, h, options), ww, wh)
return
if ww>MAX_WINDOW_SIZE or wh>MAX_WINDOW_SIZE:
if first_time("window-oversize-%i" % self.wid):
damagelog.warn("Warning: invalid window dimensions %ix%i for window %i", ww, wh, self.wid)
damagelog.warn(" window updates will be dropped until this is corrected")
return
now = monotonic_time()
if options is None:
options = {}
Expand Down
6 changes: 1 addition & 5 deletions src/xpra/x11/common.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# This file is part of Xpra.
# Copyright (C) 2017 Antoine Martin <[email protected]>
# Copyright (C) 2017-2020 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

#if you want to use a virtual screen bigger than 32767x32767
#you will need to change those values, but some broken toolkits
#will then misbehave (they use signed shorts instead of signed ints..)
MAX_WINDOW_SIZE = 2**15-1

class Unmanageable(Exception):
pass
Expand Down
3 changes: 2 additions & 1 deletion src/xpra/x11/gtk_x11/wm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
from gi.repository import GObject, Gdk

from xpra.util import envbool
from xpra.common import MAX_WINDOW_SIZE
from xpra.gtk_common.error import xsync, xswallow
from xpra.x11.gtk_x11.prop import prop_set, prop_get, prop_del
from xpra.x11.window_info import window_name, window_info
from xpra.gtk_common.gobject_util import no_arg_signal, one_arg_signal
from xpra.gtk_common.gtk_util import get_default_root_window, GDKWindow
from xpra.x11.common import Unmanageable, MAX_WINDOW_SIZE
from xpra.x11.common import Unmanageable
from xpra.x11.gtk_x11.selection import ManagerSelection
from xpra.x11.models.window import WindowModel, configure_bits
from xpra.x11.gtk_x11.world_window import WorldWindow
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/x11/models/size_hints_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# later version. See the file COPYING for details.


from xpra.x11.common import MAX_WINDOW_SIZE
from xpra.common import MAX_WINDOW_SIZE
from xpra.log import Logger

log = Logger("x11", "window")
Expand Down
3 changes: 2 additions & 1 deletion src/xpra/x11/models/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
from gi.repository import GObject, Gtk, Gdk

from xpra.util import envint, envbool, typedict
from xpra.common import MAX_WINDOW_SIZE
from xpra.gtk_common.gobject_util import one_arg_signal, non_none_list_accumulator, SIGNAL_RUN_LAST
from xpra.gtk_common.error import XError, XSwallowContext
from xpra.x11.gtk_x11.send_wm import send_wm_take_focus
from xpra.x11.gtk_x11.prop import prop_set, prop_get
from xpra.x11.prop_conv import MotifWMHints
from xpra.x11.bindings.window_bindings import X11WindowBindings #@UnresolvedImport
from xpra.x11.common import Unmanageable, MAX_WINDOW_SIZE
from xpra.x11.common import Unmanageable
from xpra.x11.models.size_hints_util import sanitize_size_hints
from xpra.x11.models.base import BaseWindowModel, constants
from xpra.x11.models.core import sanestr, xswallow, xsync
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/x11/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
from xpra.version_util import XPRA_VERSION
from xpra.util import updict, rindex, envbool, envint, typedict, WORKSPACE_NAMES
from xpra.os_util import memoryview_to_bytes, strtobytes, bytestostr, monotonic_time
from xpra.common import CLOBBER_UPGRADE
from xpra.common import CLOBBER_UPGRADE, MAX_WINDOW_SIZE
from xpra.server import server_features
from xpra.server.source.windows_mixin import WindowsMixin
from xpra.gtk_common.gobject_util import one_arg_signal
from xpra.gtk_common.gtk_util import get_default_root_window
from xpra.x11.common import Unmanageable, MAX_WINDOW_SIZE
from xpra.x11.common import Unmanageable
from xpra.x11.gtk_x11.prop import prop_set
from xpra.x11.gtk_x11.tray import get_tray_window, SystemTray
from xpra.x11.gtk_x11.gdk_bindings import (
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/x11/x11_server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from xpra.x11.gtk_x11.prop import prop_get, prop_set
from xpra.x11.gtk_x11.gdk_display_source import close_gdk_display_source
from xpra.x11.gtk_x11.gdk_bindings import init_x11_filter, cleanup_x11_filter, cleanup_all_event_receivers
from xpra.x11.common import MAX_WINDOW_SIZE
from xpra.common import MAX_WINDOW_SIZE
from xpra.os_util import monotonic_time, strtobytes
from xpra.util import typedict, iround, envbool, XPRA_DPI_NOTIFICATION_ID
from xpra.net.compression import Compressed
Expand Down

0 comments on commit 310b98c

Please sign in to comment.