From 0e32283a6a2f59da5eec5c9676e30e3443c44e19 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 9 Oct 2017 16:13:25 +0000 Subject: [PATCH] #1656: stricter randr size return value checking git-svn-id: https://xpra.org/svn/Xpra/trunk@17135 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/x11/bindings/randr_bindings.pyx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xpra/x11/bindings/randr_bindings.pyx b/src/xpra/x11/bindings/randr_bindings.pyx index c95d207e8e..7b82d764ca 100644 --- a/src/xpra/x11/bindings/randr_bindings.pyx +++ b/src/xpra/x11/bindings/randr_bindings.pyx @@ -251,6 +251,7 @@ cdef class _RandRBindings(_X11CoreBindings): cdef Rotation original_rotation cdef int num_sizes = 0 #@DuplicatedSignature cdef SizeID size_id + cdef int width, height window = XDefaultRootWindow(self.display) cdef XRRScreenConfiguration *config = NULL #@DuplicatedSignature try: @@ -263,9 +264,12 @@ cdef class _RandRBindings(_X11CoreBindings): size_id = XRRConfigCurrentConfiguration(config, &original_rotation) if size_id<0: raise Exception("failed to get current configuration") + if size_id>=num_sizes: + raise Exception("invalid size ID") width = xrrs[size_id].width; height = xrrs[size_id].height; + assert width>0 and height>0, "invalid XRR size: %ix%i" % (width, height) return int(width), int(height) finally: if config!=NULL: