mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-01 12:07:31 +01:00
Kernel: Fix sysclib strchr/strrchr, TLS pool leak, FPL counter
- sysclib strchr/strrchr searched for the whole string, not the character, so they returned 0 for any nonzero c. - A thread ending with blocks from more than one TLS pool leaked every other block, since the restarted loop's ++iter skipped an entry. - FPL's nextBlock grew by up to numBlocks per allocation and eventually overflowed into a negative block index. Old states with a negative one now reset it rather than failing to load. - sysclib strncpy bounded its copy by the source's valid size only, not the destination's. - sceKernelAllocHeapMemory wrapped for sizes near 4GB, and sceKernelGetModuleIdList could write a partial entry past the buffer size and dereferenced a missing module. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
210be3b311
commit
22b6fcbf22
4 files changed
+34
-24
No files matched your search
@@ -3846,8 +3846,12 @@ static u32 sceKernelGetModuleIdList(u32 resultBuffer, u32 resultBufferSize, u32
|
||||
u32 error;
|
||||
for (SceUID moduleId : loadedModules) {
|
||||
PSPModule *module = kernelObjects.Get<PSPModule>(moduleId, error);
|
||||
if (!module) {
|
||||
continue;
|
||||
}
|
||||
if (!module->isFake || liedAboutThisModule(module)) {
|
||||
if (resultBufferOffset < resultBufferSize) {
|
||||
// Only whole entries.
|
||||
if (resultBufferOffset + 4 <= resultBufferSize) {
|
||||
Memory::WriteOrException_U32(module->GetUID(), resultBuffer + resultBufferOffset);
|
||||
resultBufferOffset += 4;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user