Fix out-of-bounds reads in PGF font parsing

PGF::ReadPtr walked four length-prefixed tables and computed table sizes
before any bounds check, and used signed 32-bit size math that could
overflow, allowing a crafted font to read past the input buffer.

- Validate the total size of all tables up front using 64-bit math.
- Check the rev3 extra header fits before reading it.
- Cap charPointerLength/charMapLength/shadowMapLength to avoid absurd
  allocations.
- Bounds-check glyph data offsets before reading each glyph.

Also throw in a warning fix
This commit is contained in:
Henrik Rydgård committed 2026-08-01 11:57:27 +02:00
1 parent a8195e7ca6
commit 788150c28e
2 files changed
+45 -13

No files matched your search

+5 -6
View File
@@ -2625,15 +2625,14 @@ int sceKernelReleaseWaitThread(SceUID threadID) {
if (!t) {
return hleLogError(Log::sceKernel, error, "bad thread ID");
} else {
if (!t->isWaiting())
return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_NOT_WAIT);
if (t->nt.waitType == WAITTYPE_HLEDELAY)
{
if (!t->isWaiting()) {
return hleLogInfo(Log::sceKernel, SCE_KERNEL_ERROR_NOT_WAIT);
}
if (t->nt.waitType == WAITTYPE_HLEDELAY) {
WARN_LOG_REPORT_ONCE(rwt_delay, Log::sceKernel, "sceKernelReleaseWaitThread(): Refusing to wake HLE-delayed thread, right thing to do?");
return hleNoLog(SCE_KERNEL_ERROR_NOT_WAIT);
}
if (t->nt.waitType == WAITTYPE_MODULE)
{
if (t->nt.waitType == WAITTYPE_MODULE) {
WARN_LOG_REPORT_ONCE(rwt_sm, Log::sceKernel, "sceKernelReleaseWaitThread(): Refusing to wake start_module thread, right thing to do?");
return hleNoLog(SCE_KERNEL_ERROR_NOT_WAIT);
}