aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Window.c
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-02-10 18:41:08 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-02-10 19:40:39 +0100
commit2d68caca72bd36b168b36b252c8035643c69e692 (patch)
treed86206f39973bd98d82f0f865be2315330006eab /nx-X11/programs/Xserver/hw/nxagent/Window.c
parent4dac57f3db5b283eb419f1e108cc8510bad1b0af (diff)
downloadnx-libs-2d68caca72bd36b168b36b252c8035643c69e692.tar.gz
nx-libs-2d68caca72bd36b168b36b252c8035643c69e692.tar.bz2
nx-libs-2d68caca72bd36b168b36b252c8035643c69e692.zip
Create Windows and fix drawing issues on Big Endian 64bit systems (057_nx-X11_sanitize-eventmasks.full.patch).
Multiple endiannes issues were setting incorrect event masks when creating and drawing X11 windows. This time, a smaller integer has been casted to a bigger one and passed to some function actually setting its value. This meant, that garbage from stack was attached to the smaller integer value, putting unknown memory into the lower bytes of the bigger integer. Fix this by creating a big, initialized temporary variable, let the function do its magic on that one and pass the value back to the smaller variable--and cross your fingers the smaller variable can hold it without overrunning. (The last bit is a design issue we can't really fix and has been around even before this patch.)
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index 35a35984a..2ba37a550 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -327,7 +327,10 @@ FIXME: We need to set save under on the real display?
if (mask & CWEventMask)
{
- nxagentGetEventMask(pWin, (Mask*)&attributes.event_mask);
+ /* Assume that the mask fits in int... broken on Big Endian 64bit systems. */
+ Mask tmp_mask = attributes.event_mask;
+ nxagentGetEventMask(pWin, &tmp_mask);
+ attributes.event_mask = (int)tmp_mask;
}
#ifdef WARNING
else
@@ -2891,7 +2894,10 @@ FIXME: Do we need to set save unders attribute here?
if (mask & CWEventMask)
{
- nxagentGetEventMask(pWin, (Mask*)&attributes.event_mask);
+ /* Assume that the mask fits in int... broken on Big Endian 64bit systems. */
+ Mask tmp_mask = attributes.event_mask;
+ nxagentGetEventMask(pWin, &tmp_mask);
+ attributes.event_mask = (int)tmp_mask;
}
#ifdef WARNING
else
@@ -3352,7 +3358,10 @@ void nxagentSetTopLevelEventMask(pWin)
if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin))
{
- nxagentGetEventMask(pWin, (Mask*)&attributes.event_mask);
+ /* Assume that the mask fits in int... broken on Big Endian 64bit systems. */
+ Mask tmp_mask = attributes.event_mask;
+ nxagentGetEventMask(pWin, &tmp_mask);
+ attributes.event_mask = (int)tmp_mask;
XChangeWindowAttributes(nxagentDisplay, nxagentWindow(pWin), mask, &attributes);
}