From 57e64547b39c3e10de4166858e848dd5bb9204a2 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 28 Feb 2014 21:52:34 -0800 Subject: [PATCH] Fix sceFontSetResolution() error codes. --- Core/HLE/sceFont.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 5d74d38df2..bc2b2918b3 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -1136,11 +1136,17 @@ int sceFontGetNumFontList(u32 fontLibHandle, u32 errorCodePtr) { } int sceFontSetResolution(u32 fontLibHandle, float hRes, float vRes) { - INFO_LOG(SCEFONT, "sceFontSetResolution(%08x, %f, %f)", fontLibHandle, hRes, vRes); FontLib *fl = GetFontLib(fontLibHandle); - if (fl) { - fl->SetResolution(hRes, vRes); + if (!fl) { + ERROR_LOG_REPORT(SCEFONT, "sceFontSetResolution(%08x, %f, %f): invalid font lib", fontLibHandle, hRes, vRes); + return ERROR_FONT_INVALID_LIBID; } + if (hRes <= 0.0f || vRes <= 0.0f) { + ERROR_LOG_REPORT(SCEFONT, "sceFontSetResolution(%08x, %f, %f): negative value", fontLibHandle, hRes, vRes); + return ERROR_FONT_INVALID_PARAMETER; + } + INFO_LOG(SCEFONT, "sceFontSetResolution(%08x, %f, %f)", fontLibHandle, hRes, vRes); + fl->SetResolution(hRes, vRes); return 0; }