Skip to content
This repository has been archived by the owner. It is now read-only.

Prevent crash during ffi.load() when dlerror() returns NULL #19

Merged
merged 2 commits into from
Nov 1, 2019

Conversation

mcclure
Copy link

@mcclure mcclure commented Nov 1, 2019

Per the standard definition of dlerror, it should never return NULL, but we (lovr.org) have observed dlerror returning NULL anyway on certain versions of Android (Android 7.1.1 on Oculus Quest when loading a nonexistent .so). Current LuaJIT implementation crashes at this point and MoonJIT is affected. The patch issues a well-formed error instead of crashing.

This patch is currently in the WohlSoft LuaJIT fork with a more extensive comment WohlSoft#13 and is in the queue in LuaJIT. LuaJIT#522

Per the standard definition of dlerror, this should never happen, but we have observed it occurring on certain versions of Android anyway.
@siddhesh
Copy link
Collaborator

siddhesh commented Nov 1, 2019

Thanks, can you please add the comment too? It is useful and will prevent people from accidentally removing the check in future.

where a crash was recognized for what workaround was developed
@mcclure
Copy link
Author

mcclure commented Nov 1, 2019

Here's the commit adding the message from the Wohlsoft fork— does this work?

@siddhesh siddhesh merged commit 821050b into moonjit:v2.1 Nov 1, 2019
@siddhesh
Copy link
Collaborator

siddhesh commented Nov 1, 2019

Perfect, I've added this to master as well now. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants