mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-04 15:06:25 +00:00
Check a potential crash in sceFontOpen().
This commit is contained in:
parent
f9e4739c64
commit
7741376a38
@ -605,13 +605,18 @@ int sceFontDoneLib(u32 fontLibHandle) {
|
||||
|
||||
// Open internal font into a FontLib
|
||||
u32 sceFontOpen(u32 libHandle, u32 index, u32 mode, u32 errorCodePtr) {
|
||||
INFO_LOG(HLE, "sceFontOpen(%x, %x, %x, %x)", libHandle, index, mode, errorCodePtr);
|
||||
if (!Memory::IsValidAddress(errorCodePtr)) {
|
||||
Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr);
|
||||
// Would crash on the PSP.
|
||||
ERROR_LOG(HLE, "sceFontOpen(%x, %x, %x, %x): invalid pointer", libHandle, index, mode, errorCodePtr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
INFO_LOG(HLE, "sceFontOpen(%x, %x, %x, %x)", libHandle, index, mode, errorCodePtr);
|
||||
FontLib *fontLib = GetFontLib(libHandle);
|
||||
if (fontLib == NULL) {
|
||||
Memory::Write_U32(ERROR_FONT_INVALID_LIBID, errorCodePtr);
|
||||
return 0;
|
||||
}
|
||||
if (index >= internalFonts.size()) {
|
||||
Memory::Write_U32(ERROR_FONT_INVALID_PARAMETER, errorCodePtr);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user