SDL_LoadObject (windows, os/2): prevent crash if dll name is NULL.

main
Ozkan Sezer 2020-12-13 17:37:50 +03:00
parent f674009c56
commit 3b92933ac6
2 changed files with 16 additions and 2 deletions

View File

@ -37,9 +37,15 @@ SDL_LoadObject(const char *sofile)
{ {
ULONG ulRC; ULONG ulRC;
HMODULE hModule; HMODULE hModule;
PSZ pszModName = OS2_UTF8ToSys(sofile);
CHAR acError[256]; CHAR acError[256];
PSZ pszModName;
if (!sofile) {
SDL_SetError("NULL sofile");
return NULL;
}
pszModName = OS2_UTF8ToSys(sofile);
ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule); ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule);
SDL_free(pszModName); SDL_free(pszModName);
if (ulRC != NO_ERROR) { if (ulRC != NO_ERROR) {

View File

@ -32,7 +32,15 @@
void * void *
SDL_LoadObject(const char *sofile) SDL_LoadObject(const char *sofile)
{ {
LPTSTR tstr = WIN_UTF8ToString(sofile); LPTSTR tstr;
if (!sofile) {
SDL_SetError("NULL sofile");
return NULL;
}
tstr = WIN_UTF8ToString(sofile);
#ifdef __WINRT__ #ifdef __WINRT__
/* WinRT only publically supports LoadPackagedLibrary() for loading .dll /* WinRT only publically supports LoadPackagedLibrary() for loading .dll
files. LoadLibrary() is a private API, and not available for apps files. LoadLibrary() is a private API, and not available for apps