mirror of
https://github.com/yawut/SDL.git
synced 2026-10-02 05:06:46 -05:00
Prevent crash from unaligned memory access on sparc64, etc.
Fixes Bugzilla #602. I suspect this will crash elsewhere if the system actually had modelines to report, though. --HG-- branch : SDL-1.2
This commit is contained in:
@@ -214,6 +214,12 @@ SDL_NAME(XF86VidModeGetGamma)(Display *dpy, int screen, SDL_NAME(XF86VidModeGamm
|
||||
return True;
|
||||
}
|
||||
|
||||
/* this is to prevent an unaligned memory write on CPUs that need that. */
|
||||
static void zap_ptr(char *ptr, size_t size)
|
||||
{
|
||||
memset(ptr, '\0', size);
|
||||
}
|
||||
|
||||
Bool
|
||||
SDL_NAME(XF86VidModeGetModeLine)(dpy, screen, dotclock, modeline)
|
||||
Display* dpy;
|
||||
@@ -284,7 +290,7 @@ SDL_NAME(XF86VidModeGetModeLine)(dpy, screen, dotclock, modeline)
|
||||
}
|
||||
_XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
|
||||
} else {
|
||||
modeline->private = NULL;
|
||||
zap_ptr((char *)&modeline->private, sizeof(modeline->private))
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
Reference in New Issue
Block a user