Skip to content

Commit

Permalink
#1656: stricter randr size return value checking
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@17135 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 9, 2017
1 parent 2b9d977 commit 0e32283
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/xpra/x11/bindings/randr_bindings.pyx
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 0e32283

Please sign in to comment.