Bug 3756 - Q3VM crashes on unaligned block copy with SIGBUS
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Platform
Version: GIT MASTER
Hardware: SGI IRIX
: P3 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2008-08-19 20:42 EDT by Patrick Baggett
Modified: 2008-08-22 18:47:48 EDT
0 users

See Also:


Attachments
Fixes unaligned access issue. (822 bytes, patch)
2008-08-19 20:43 EDT, Patrick Baggett

Description Patrick Baggett 2008-08-19 20:42:50 EDT
Noticed with Tremulous and (rarely) IOQuake3. When a block copy is not aligned, a warning message in the VM is displayed, and then the block copy is attempted. On a RISC processor such as MIPS, SPARC, or PowerPC, this causes a SIGBUS, crashing the game. This patch does a few things:
a) Resolves the issue by using memcpy() instead. Using memcpy() will be faster and  more reliable than a for() loop copying integers since most every OS provides a fast implementation of memcpy(), including IRIX, Solaris, Linux, Windows, and MacOS X.
b) Removes code and messages to detect unaligned data. To ensure correct functionality, I first applied the memcpy() fix, then reproduced the unaligned memory copies. The game did not crash. After that I removed the detection and messages.
Comment 1 Patrick Baggett 2008-08-19 20:43:40 EDT
Created attachment 1834 [details]
Fixes unaligned access issue.

Fixes unaligned access issue as described above.
Comment 2 Tim Angus 2008-08-22 18:47:48 EDT
Fixed in r1456.