[SVN] r4083 - branches/SDL-1.2/src/video/Xext/Xxf86vm
svn-owner at libsdl.org
svn-owner at libsdl.org
Mon Sep 8 00:33:05 PDT 2008
Author: icculus
Date: 2008-09-08 00:33:05 -0700 (Mon, 08 Sep 2008)
New Revision: 4083
Modified:
branches/SDL-1.2/src/video/Xext/Xxf86vm/XF86VMode.c
Log:
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.
Modified: branches/SDL-1.2/src/video/Xext/Xxf86vm/XF86VMode.c
===================================================================
--- branches/SDL-1.2/src/video/Xext/Xxf86vm/XF86VMode.c 2008-09-06 04:31:34 UTC (rev 4082)
+++ branches/SDL-1.2/src/video/Xext/Xxf86vm/XF86VMode.c 2008-09-08 07:33:05 UTC (rev 4083)
@@ -214,6 +214,12 @@
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 @@
}
_XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
} else {
- modeline->private = NULL;
+ zap_ptr((char *)&modeline->private, sizeof(modeline->private))
}
UnlockDisplay(dpy);
SyncHandle();
More information about the commits
mailing list