| Summary: | SDL based apps crash when run remotely from sparc64 and being dispayed on a i386 system | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Brad Smith <brad> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | 1.2.13 | ||
| Hardware: | x86 | ||
| OS: | OpenBSD | ||
|
Description
Brad Smith
2008-07-05 18:00:19 UTC
I fixed this with the following patch (sorry, the attachment thing doesn't work):
--- src/video/Xext/Xxf86vm/XF86VMode.c.orig Mon Dec 31 04:48:09 2007
+++ src/video/Xext/Xxf86vm/XF86VMode.c Fri Aug 22 18:59:44 2008
@@ -281,7 +281,8 @@
}
_XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
} else {
- modeline->private = NULL;
+ // Avoid unaligned trap on Sparc64
+ memset(&modeline->private, '\0', sizeof(modeline->private));
}
UnlockDisplay(dpy);
SyncHandle();
> I fixed this with the following patch
As we had talked about in private I tried out your diff and SDL is still crashing. I double checked and rebuilt the library just to make sure and indeed it is still crashing.
(In reply to comment #2) > > I fixed this with the following patch > > As we had talked about in private I tried out your diff and SDL is still > crashing. I double checked and rebuilt the library just to make sure and indeed > it is still crashing. > Sorry, I had changed the compiler flags from -O2 to -g, and with -O2 level gcc optimizes the memset back to stx which we want to avoid. This version works by calling memset more indirectly. --- src/video/Xext/Xxf86vm/XF86VMode.c.orig Mon Dec 31 04:48:09 2007 +++ src/video/Xext/Xxf86vm/XF86VMode.c Sun Sep 7 11:48:19 2008 @@ -211,6 +211,11 @@ return True; } +static inline void zap_ptr(char *ptr, size_t size) +{ + memset(ptr, '\0', size); +} + Bool SDL_NAME(XF86VidModeGetModeLine)(dpy, screen, dotclock, modeline) Display* dpy; @@ -281,7 +286,8 @@ } _XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32)); } else { - modeline->private = NULL; + // Avoid unaligned trap on Sparc64 + zap_ptr((char *)&modeline->private, sizeof(modeline->private)); } UnlockDisplay(dpy); SyncHandle(); Yes, that does the trick. Fixed in svn revision #4083 for the 1.2 branch, and #4084 for the 1.3 branch. Thanks! --ryan. svn revisions #4097 and #4098 have a hopefully-better fix for this. --ryan. |