Merge pull request #6376 from nulano/fribidi-no-version

Fixed null check for fribidi_version_info in FriBiDi shim
This commit is contained in:
Andrew Murray 2022-06-30 19:27:28 +10:00 committed by GitHub
commit d66e730fea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ static void fribidi_get_bracket_types_compat(
int load_fribidi(void) {
int error = 0;
const char **p_fribidi_version_info = 0;
p_fribidi = 0;
@ -87,20 +88,21 @@ int load_fribidi(void) {
LOAD_FUNCTION(fribidi_get_par_embedding_levels);
#ifndef _WIN32
fribidi_version_info = *(const char**)dlsym(p_fribidi, "fribidi_version_info");
if (error || (fribidi_version_info == 0)) {
p_fribidi_version_info = (const char**)dlsym(p_fribidi, "fribidi_version_info");
if (error || (p_fribidi_version_info == 0) || (*p_fribidi_version_info == 0)) {
dlclose(p_fribidi);
p_fribidi = 0;
return 2;
}
#else
fribidi_version_info = *(const char**)GetProcAddress(p_fribidi, "fribidi_version_info");
if (error || (fribidi_version_info == 0)) {
p_fribidi_version_info = (const char**)GetProcAddress(p_fribidi, "fribidi_version_info");
if (error || (p_fribidi_version_info == 0) || (*p_fribidi_version_info == 0)) {
FreeLibrary(p_fribidi);
p_fribidi = 0;
return 2;
}
#endif
fribidi_version_info = *p_fribidi_version_info;
return 0;
}