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 - Default for SDL_SIMDAlignment causes crashes on some 64-bit systems
Summary: Default for SDL_SIMDAlignment causes crashes on some 64-bit systems
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: main (show other bugs)
Version: 2.0.10
Hardware: Other OpenBSD
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.12
Depends on:
Blocks:
 
Reported: 2019-10-21 01:52 UTC by Simon Howard
Modified: 2019-10-21 02:19 UTC (History)
1 user (show)

See Also:


Attachments
Patch to fix bug. (526 bytes, patch)
2019-10-21 01:52 UTC, Simon Howard
Details | Diff

Note You need to log in before you can comment on or make changes to this 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.