Commit 587c3a2d1961834558193e8e14e8e381a077a253 fixed DoGetImage to
check windows against their backing drawables, rather than against the
screen dimensions, to prevent reading outside the bounds of redirected
windows' backing pixmaps (see bug #22804). Unfortunately, while
making that change I also removed the check that the rectangle is
contained within the bounds of the source window, which is a violation
of the specification:

If the drawable is a window, the window must be viewable, and it
must be the case that, if there were no inferiors or overlapping
windows, the specified rectangle of the window would be fully
visible on the screen *and wholly contained within the outside
edges of the window* (or a Match error results). Note that the
borders of the window can be included and read with this request.

(emphasis mine)

Reinstate the window dimension check, to return BadMatch if the
GetImage request falls outside the bounds of the window.