I've seen many reports of users having issues loading even moderately-sized SOFAs in software that uses libmysofa, due to the current limit. Even for OpenAL Soft's makemhr converter I had to use my fork where I removed the limit, but the dev suggested a better, safer alternative which I figured I'd share here in case it's a viable option:
Looks like it may need an overflow check too. Something like
I don't know how this check in specific relates to the file or dataset size, but at least the result of elements * size can't go far above 2.1 billion, or else it'll overflow and become undefined behavior. Expanding that would need more work to avoid signed ints, where those kinds of changes tend to need farther reaching changes since those variables may interact with other variables that may not be happy when they're different types.
I've seen many reports of users having issues loading even moderately-sized SOFAs in software that uses libmysofa, due to the current limit. Even for OpenAL Soft's makemhr converter I had to use my fork where I removed the limit, but the dev suggested a better, safer alternative which I figured I'd share here in case it's a viable option: