Skip to content

dso: Check for NULL handle in apr_dso_sym #40

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dso/unix/dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
apr_dso_handle_t *handle,
const char *symname)
{
/* This is necessary for `testdso.c`. For some reason, musl
* builds fail the `test_unload_library` test if the below
* check isn't in place. `test_unload_library` unloads the
* library and then immediately calls this function. Maybe
* musl's `dlsym()` assumes the handle is never NULL and
* some UB is being invoked here...
*/
if (handle->handle == NULL) {
handle->errormsg = "library not loaded";
return APR_ESYMNOTFOUND;
}

#if defined(DSO_USE_SHL)
void *symaddr = NULL;
int status;
Expand Down