# HG changeset patch # User Ryan C. Gordon # Date 1220859185 0 # Node ID cab9823cb55ea9d3af6bef7dca15e2b0645feb4d # Parent 1019eb074a566e6c8d3b7be2b678b7ed9554b28f 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. diff -r 1019eb074a56 -r cab9823cb55e src/video/Xext/Xxf86vm/XF86VMode.c --- a/src/video/Xext/Xxf86vm/XF86VMode.c Thu Aug 07 20:55:45 2008 +0000 +++ b/src/video/Xext/Xxf86vm/XF86VMode.c Mon Sep 08 07:33:05 2008 +0000 @@ -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();