Skip to content

Conversation

@ccawley2011
Copy link

This can cause crashes on older ARM processors, as well as on newer ones with alignment exceptions enabled.

@sezero
Copy link
Contributor

sezero commented Apr 9, 2022

There are many other places in code that does foo = *(DWORD *)src; (or
foo = *(WORD *)src) which are potentially unaligned accesses. I ended
up with this yet-incomplete and to-be-verified patch: patch.txt.

ReadSample() of sndfile.c possibly needs similar love & care, not sure.
And several of the loaders would need revising for endian and alignment
safety.

@AliceLR
Copy link
Contributor

AliceLR commented Apr 9, 2022

Does #pragma pack(1) on the affected structs not already fix this?
edit: seems whether or not this forces the compiler to emit unaligned access safe code might be target-dependent.

@Apaczer
Copy link

Apaczer commented Jan 24, 2023

@ccawley2011, thank you immensly! It helped almost fully to eliminate PSM_Load errors on ARM32 device!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants