nsysnet: Avoid crash on NULL timeout in select (#1324)

This commit is contained in:
Joshua de Reeper 2024-09-02 15:20:16 +01:00 committed by GitHub
parent 9a53b19403
commit b06990607d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1210,6 +1210,14 @@ void nsysnetExport_select(PPCInterpreter_t* hCPU)
timeval tv = { 0 }; timeval tv = { 0 };
if (timeOut == NULL)
{
// return immediately
cemuLog_log(LogType::Socket, "select returned immediately because of null timeout");
osLib_returnFromFunction(hCPU, 0);
return;
}
uint64 msTimeout = (_swapEndianU32(timeOut->tv_usec) / 1000) + (_swapEndianU32(timeOut->tv_sec) * 1000); uint64 msTimeout = (_swapEndianU32(timeOut->tv_usec) / 1000) + (_swapEndianU32(timeOut->tv_sec) * 1000);
uint32 startTime = GetTickCount(); uint32 startTime = GetTickCount();
while (true) while (true)