We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4835

Summary: Default for SDL_SIMDAlignment causes crashes on some 64-bit systems
Product: SDL Reporter: Simon Howard <fraggle+libsdl>
Component: mainAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.10Keywords: target-2.0.12
Hardware: Other   
OS: OpenBSD   
Attachments: Patch to fix bug.

Description Simon Howard 2019-10-21 01:52:59 UTC
Created attachment 3989 [details]
Patch to fix bug.

In SDL_cpuinfo.c the default value for SDL_SIMDAlignment is set to 4 unless system-specific CPU features are detected. This can cause SDL_SIMDAlloc() to crash on MIPS64 systems because memory is allocated on 4-byte boundaries, but MIPS64 requires 8-byte alignment (unaligned accesses cause a Bus Error).

Changing to sizeof(void *) should make for a safer default and fixes the crash. Diff attached.
Comment 1 Ryan C. Gordon 2019-10-21 02:19:54 UTC
Your patch is now https://hg.libsdl.org/SDL/rev/568f67c04841, thanks!

--ryan.