Skip to content

Be safer about null dlopen returns #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rcombs opened this issue Sep 25, 2020 · 0 comments · Fixed by #21
Closed

Be safer about null dlopen returns #20

rcombs opened this issue Sep 25, 2020 · 0 comments · Fixed by #21

Comments

@rcombs
Copy link

rcombs commented Sep 25, 2020

Currently, if _sclOpenICDLoader returns NULL, we still pass the result to _sclGetFunctionAddress. This happens to be handled gracefully in glibc, where RTLD_DEFAULT is NULL, but that's not guaranteed. As far as I can tell, Windows's behavior when NULL is passed to GetProcAddress is more or less identical, but completely undocumented. We shouldn't rely on this.

This could actually lead to infinite recursion depending on linker configuration, since we could end up loading and calling into our own copy of clGetPlatformIDs if we do an RTLD_DEFAULT search. If we get NULL back from _sclOpenICDLoader (or _sclGetICDLoaderHandle, after #18), we should error out immediately.

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 a pull request may close this issue.

1 participant