mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 20:04:31 +01:00
libretro: fix OOB, UAF, data races and control flow in core glue
System_AudioPushSamples converts straight into the output buffer: the block loop never advanced the source pointer and copied numSamples*2 int16s out of a 2048-sample stack buffer, a stack OOB read for any push over 1024 frames. Realloc failure drops samples instead of crashing and log_cb is NULL-checked. retro_serialize refuses to write a state larger than the frontend's buffer, retro_get_memory_data/size return nothing until PSP memory is mapped, deferred unserialize no longer leaks the previous buffer, and the cheat entry points stop leaking a CWCheatEngine per call. The emu thread acknowledges a pause with a CAS so it cannot clobber a concurrent quit request. EmuThreadStop stops and joins from any live state, so unloading while paused no longer leaves a thread running over freed state. EmuThreadPause pumps queued frames until the thread parks, via a new non-blocking GLRenderManager::HasQueuedThreadWork() check, instead of draining one frame, which deadlocked when the thread was blocked on a readback sync in the next frame. retro_run resumes a paused thread and pauses it before check_variables() rewrites g_Config, retro_reset stops it before PSP_Shutdown(), and the sleep_ms(4) after resume is gone.
This commit is contained in:
1 parent
8abc5920c6
commit
b71fbaeb5c
5 files changed
+101
-59
No files matched your search
@@ -249,6 +249,11 @@ public:
|
||||
void ThreadStart(Draw::DrawContext *draw);
|
||||
void ThreadEnd();
|
||||
bool ThreadFrame(); // False means it's time to exit.
|
||||
// True if ThreadFrame() has queued work and will not block on an empty queue.
|
||||
bool HasQueuedThreadWork() {
|
||||
std::lock_guard<std::mutex> lock(pushMutex_);
|
||||
return !renderThreadQueue_.empty();
|
||||
}
|
||||
|
||||
void NotifyEmuThreadExit();
|
||||
|
||||
|
||||
Reference in new issue
Block a user