Skip to content

Commit 0af737c

Browse files
authored
Use strcmp() to compare f_lib and JL_LIBJULIA_DL_LIBNAME (#39005)
This future-proofs us from someone trying lookup a symbol from `libjulia.dll`, even though that should be quite rare, it may happen.
1 parent d0478ca commit 0af737c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/runtime_ccall.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ extern "C"
3030
void *jl_get_library_(const char *f_lib, int throw_err) JL_NOTSAFEPOINT
3131
{
3232
void *hnd;
33+
if (f_lib == NULL)
34+
return jl_RTLD_DEFAULT_handle;
3335
#ifdef _OS_WINDOWS_
3436
if (f_lib == JL_EXE_LIBNAME)
3537
return jl_exe_handle;
3638
if (f_lib == JL_LIBJULIA_INTERNAL_DL_LIBNAME)
3739
return jl_libjulia_internal_handle;
38-
if (f_lib == JL_LIBJULIA_DL_LIBNAME)
40+
if (strcmp(f_lib, JL_LIBJULIA_DL_LIBNAME) == 0)
3941
return jl_libjulia_handle;
4042
#endif
41-
if (f_lib == NULL)
42-
return jl_RTLD_DEFAULT_handle;
4343
JL_LOCK_NOGC(&libmap_lock);
4444
// This is the only operation we do on the map, which doesn't invalidate
4545
// any references or iterators.

0 commit comments

Comments
 (0)